IM-PDI/ZFO S-scheme heterojunction assembled by mutual magnetic attraction possesses good selective photodegradation ability for TC. [Display omitted] • ZFO aggregates PDI by mutual magnetic attraction, increasing the contact area with pollutants. • The formed S-scheme heterojunction enhances the degradation ability of pollutants. • The ability of IM-PDI/ZFO to specifically degrade TC is enhanced by imprinting modification. • The selectivity coefficient of IM-PDI/ZFO to non-imprinted modified PDI/ZFO can reach 2.31. Recyclable and stable imprinting modified PDI/ZnFe 2 O 4 (IM-PDI/ZFO) was assembled by mutual magnetic attraction. Interestingly, the obtained IM-PDI/ZFO exhibited granular ZnFe 2 O 4 (ZFO) attached to the aggregated PDI. The mutual magnetic attraction of ZFO leaded to the aggregation of PDI, which effectively improved the ability of IM-PDI/ZFO to enrich pollutants and further enhanced the photodegradation activity. Meanwhile, due to the appropriate energy band position, PDI and ZFO formed an S-scheme heterojunction, eliminating useless photogenerated charge carriers and enhancing the photodegradation ability of IM-PDI/ZFO. Most importantly, because of the introduction of imprinting modification technology, tetracycline (TC) was added during the synthesis process. The IM-PDI/ZFO obtained imprinted cavities consistent with the three-dimensional structure of TC, which was not only conducive to improve the photocatalytic activity under visible light, but also endowed IM-PDI/ZFO with high selectivity, the selectivity coefficient reached 2.31. This work presents an innovative viewpoint for the synthesis of magnetic imprinted S-scheme heterojunction photocatalysts. [ABSTRACT FROM AUTHOR]