There are few studies on using spent mushroom substrates to fabricate magnetic photocatalysts. In this paper, biochar (BC) was coupled with Fe3O4/MoS2-O to form a magnetic heterostructure (Fe3O4/MoS2-O/BC) using the hydrothermal method. Under the visible light irradiation, Fe3O4/MoS2-O@BC-4 exhibited a high level of photocatalytic activity in the degradation of Levofloxacin (LVX), achieving approximately 90.64% degradation within 80 min. Furthermore, Fe3O4/MoS2-O@BC-4 demonstrated a removal efficiency exceeding 99% for Staphylococcus aureus (S. aureus) and Escherichia coli (E. coli) within a mere 20 min under visible light exposure. Additionally, the inclusion of Fe3O4 contributes to the material’s recyclability and facilitates the formation of II-scheme heterojunction. Due to the oxygen doping and heterojunction, the electron-hole pairs within Fe3O4/MoS2-O@BC were efficiently separated. The trapping experiment of reactive species and electron spin resonance (ESR) test confirms that the OH and O(2)(- )are the major active species in photocatalytic sterilization. This study introduces novel magnetic photocatalysts for environmental remediation based on the application of biomass resources.