Developing disease-suppressive soils is an effective approach for managing soilborne diseases, which can be achieved through crop metabolism and root secretion modification to recruit beneficial soil microbiota. Many factors, such as light, can elicit and modify plant metabolomic activities, resulting in disease suppression. To investigate the impact of light, Panax notoginseng was planted in a greenhouse and forest, conditioned with three levels of light intensities, including the optimal (15% light transmittance of full light), suboptimal low (5% light transmittance of full light) and suboptimal high (30% light transmittance of full light) intensities. We assessed the rhizosphere microbiota of P. notoginseng and root rot disease caused by soilborne pathogen Ilyonectria destructans, and elucidated the mechanism. Results showed that suboptimal light conditions alleviated root rot disease of P. notoginseng by enriching beneficial microbiota in the rhizosphere. Both low and high light stresses enhanced the secondary metabolism profile in favor of plant defense, particularly the flavonoid pathway. Notably, high light stress demonstrated a robust ability to promote flavonoid metabolism and secretion, resulting in the enrichment of more beneficial microorganisms that suppressed the soilborne pathogen I. destructans. These findings highlight the potential for adjusting canopy light intensities to improve soil health and promote sustainable agriculture.