To address the issue of low activation efficiency of magnetic biochar (MBC), this research synthesized nitrogen-sulfur co-doped magnetic biochar (NSMBC) using sawdust as the primary material via impregnation pyrolysis method. NSMBC effectively activated hydrogen peroxide and exhibited significant oxidation and degradation capabilities towards sulfamethazine (SMT), a sulfonamide antibiotic. The results demonstrate that under optimal conditions, NSMBC achieves a removal rate of 99.7 % for SMT within 2 h, with a reaction rate constant 8.5 times higher than that of MBC/H2O2 system. Mechanistic investigations unveiled that hydroxyl radicals (·OH) were the primary agents responsible for the degradation of sulfamethazine within the NSMBC/H2O2 system, contributing to 83.26 % of the removal efficiency. Furthermore, the nitrogen-sulfur co-doping facilitates the increase in Fe(II) content, augmentes the defect density, and enriches the number of oxygen-containing functional groups, thereby enhancing the utilization efficiency of H2O2 and consequently boosting the activation performance of magnetic biochar. Notably, the NSMBC/H2O2 system demonstrated excellent degradation efficiency towards various antibiotics, exhibiting potent broad-spectrum activity. Minimal influence on the NSMBC/H2O2 system was observed under conditions of coexisting natural organic matter and anions, rendering it suitable for practical application in the treatment of aquaculture wastewater and providing a novel technology for the application of magnetic biochar in actual water pollution control scenarios.