The conventional precursor preparation of metal–organic frameworks (MOFs) for nitrogen-doping carbon materials is divided into the preparation of MOFs and the mixing of the nitrogen source, which is a complex and time-consuming step. In this study, Fe-BTC gel/nitrogen source-derived carbon materials were synthesized using one or more of the following raw ingredients: Fe(NO3)3·9H2O, FeCl3·6H2O, Fe2(SO4)3, trimesic acid, melamine and dicyandiamide. The influence of different raw ingredients on the preparation and performance of catalysts was investigated. Fe(NO3)3·9H2O can react with trimesic acid to form a gel with ethanol as solvent, and the gel helped the homogeneous dispersion of the added melamine and did not precipitate. Fe-C-N(M), synthesized from the three materials mentioned, was identified as the optimal catalyst; the removal rate of 5 mg/L sulfadimethoxine (SMZ) reached 100% at 15 min when the Fe-C-N(M) dosage was 50 mg/L, PMS concentration was 0.5 mM, and the pH was 5.78 (initial pH of the solution). The removal of SMZ was not significantly inhibited by the pH (3–9) and 0–10 mM inorganic anions (Cl−, NO3−, HCO3− and H2PO42−). Through quenching tests, electron paramagnetic resonance and probe experiments, 1O2 and a small amount of free radicals (•OH and SO4•−) bound on the catalyst surface are discovered to be the primary active ingredients that activate PMS to degrade SMZ.