The invention discloses a photoelectrochemical biosensor for detecting histone acetyltransferase activity and a preparation method thereof. The photoelectrochemical biosensor comprises an ITO electrode, stripped WS2, polydopamine, SMCC, coenzyme A, phos-tag-biotin, and streptavidin, wherein the stripped WS2, polydopamine, SMCC, coenzyme A, phos-tag-biotin, and streptavidin are sequentially modified on the surface of the electrode. According to the photoelectrochemical biosensor and the method in the invention, by utilizing good biocompatibility and conductivity of WS2 and specifically recognized avidin and biotin, quenching of a photoelectric signal is realized, and the detection sensitivity of the histone acetyltransferase is improved. The specificity of activity detection of the histoneacetyltransferase is improved by utilizing the specific binding and identification effects of maleimide in the SMCC to sulfydryl in the CoA. The detection method disclosed by the invention is simple,miniaturization of the instrument is realized, the method is easy to operate, and the detection of the activity of the histone acetyltransferase can be realized only by simply processing the surface of the ITO electrode.