The aim of this study was to optimize the cultural conditions for Bacillus megaterium using Agaricus bisporus industrial wastewater as nature culture through response surface methodology. In our present study, we analyzed the total number of living B. megaterium in the fermentation broth using multispectral imaging flow cytometry. Plackett-Burman design was applied to evaluate the effects of six variables, namely, initial pH, industrial wastewater solubility, rotating speed, culture temperature, inoculum size, and loading volume. Loading volume, initial pH, and culture temperature were found to influence the biomass of B. megaterium significantly and were further optimized by Box-Behnken design. After verification test, the optimum fermentation conditions of B. megaterium using the A. bisporus processing wastewater as nature culture media were obtained as follows: initial pH of 7.4, culture temperature of 25°C, loading volume of 40 mL/250 mL, culture time of 24 h, industrial wastewater solubility of 1%, rotating speed of 200 rpm, and inoculum size of 8%. The predicted optimum model's value was 8.88 × 108 Obj/mL and the average experimental value was 9.03 ± 0.02 × 108 Obj/mL, which met the national microbial fertilizers' standard. Furthermore, the field experiment results showed that the fermentation broth of B. megaterium could significantly improve the yield of Spinacia oleracea L.