The search for low-cost and effective adsorbents for the removal of organic dyes from contaminated water is urgently needed. The substantial amount of waste mushroom cultivation substrates generated in practical production can serve as an ideal material for the preparation of adsorbents. In this study, we investigated the main control parameters affecting the performance of magnetic mushroom substrate biochar and optimized the process of preparing biochar by using the Plackett–Burman and central composite design methods. Various analytical techniques including SEM, EDX, BET, and VSM were used to characterize the biochar. The results indicate that the carbonization temperature had the most significant impact on the yield and adsorption performance of biochar. Under the conditions of a carbonization temperature of 600 °C, a carbonization retention time of 1 h, and an impregnation ratio of 0.1, the yield and methylene blue adsorption value of magnetic biochar were 42.54% and 2297.04 μg/g, respectively, with a specific surface area of 37.17 m2/g. This biochar effectively removed methylene blue from the solution, demonstrating a high economic efficiency for wastewater treatment and pollution control. Furthermore, the adsorption–desorption cycle studies revealed its excellent stability and reusability. Additionally, based on the response surface methodology, a three-dimensional surface model of the adsorption performance of magnetic biochar under different carbonization conditions was established, providing a theoretical basis for the preparation of magnetic biochar from agricultural wastes.