The development of high photoactive cathode materials combined with the formation of a stable interface are considered important factors for the selective and sensitive photoelectrochemical (PEC) detection of tetracycline (TC). Along these lines, in this work, a novel type II heterostructure composed of two-dimensional (2D) covalent organic frameworks confined to zero-dimensional (0D) carbon quantum dots (CDs/COFs) film was successfully synthesized using the rapid in-situ polymerization method at room temperature. The PEC signal of CDs/COFs was significantly amplified by improving the light absorption and electron transfer capabilities. Furthermore, a cathodic molecularly imprinted PEC sensor (MIP-PEC) for the detection of TC was constructed through fast in-situ Ultraviolet (UV) photopolymerization on the electrode. Finally, a “turn-off” PEC cathodic signal was achieved based on the selective recognition of the imprinted cavity and the mechanism of steric hindrance increase. Under optimal conditions, the proposed sensor demonstrated a wide linear relationship with TC in the concentration range of 5.00 × 10−12–1.00 × 10−5 M, with a detection limit as low as 6.00 × 10−13 M. Meanwhile, excellent stability, selectivity, reproducibility, and applicability in real river samples was recorded. Our work provides an effective and rapid in situ construction method for fabricating highly photoactive cathode heterojunctions and uniform stable selective MIP-PEC sensing interfaces, yielding accurate antibiotics detection in the environment.