Rhizoctonia solani is a significant pathogen affecting various crops, including tobacco. In this study, a bacterial strain, namely Y246, was isolated from the soil of healthy plants and exhibited high antifungal activity. Based on morphological identification and DNA sequencing, this bacterial strain was identified as Bacillus safensis. The aim of this investigation was to explore the antifungal potential of strain Y246, to test the antifungal stability of Y246 by adjusting different cultivation conditions, and to utilize gas chromatography–mass spectrometry (GC-MS) to predict the volatile compounds related to antifungal activity in Y246. In vitro assays demonstrated that strain Y246 exhibited a high fungal inhibition rate of 76.3%. The fermentation broth and suspension of strain Y246 inhibited the mycelial growth of R. solani by 66.59% and 63.75%, respectively. Interestingly, treatment with volatile compounds derived from the fermentation broth of strain Y246 resulted in abnormal mycelial growth of R. solani. Scanning electron microscopy analysis revealed bent and deformed mycelium structures with a rough surface. Furthermore, the stability of antifungal activity of the fermentation broth of strain Y246 was assessed. Changes in temperature, pH value, and UV irradiation time had minimal impact on the antifungal activity, indicating the stability of the antifungal activity of strain Y246. A GC-MS analysis of the volatile organic compounds (VOCs) produced by strain Y246 identified a total of 34 compounds with inhibitory effects against different fungi. Notably, the strain demonstrated broad-spectrum activity, exhibiting varying degrees of inhibition against seven pathogens (Alternaria alternata, Phomopsis. sp., Gloeosporium musarum, Dwiroopa punicae, Colletotrichum karstii, Botryosphaeria auasmontanum, and Botrytis cinerea). In our extensive experiments, strain Y246 not only exhibited strong inhibition against R. solani but also demonstrated remarkable inhibitory effects on A. alternata-induced tobacco brown spot and kiwifruit black spot, with impressive inhibition rates of 62.96% and 46.23%, respectively. Overall, these findings highlight the significant antifungal activity of B. safensis Y246 against R. solani. In addition, Y246 has an excellent antifungal stability, with an inhibition rate > 30% under different treatments (temperature, pH, UV). The results showed that the VOCs of strain Y246 had a strong inhibitory effect on the colony growth of R. solani, and the volatile substances produced by strain Y246 had an inhibitory effect on R. solani at rate of 70.19%. Based on these results, we can conclude that Y246 inhibits the normal growth of R. solani. These findings can provide valuable insights for developing sustainable agricultural strategies.