Biological control plays an increasingly important role in various aspects of modern agriculture and forestry. Identifying biocontrol strains with commercial potential for effective disease management is currently a focal point in biological control research. In this study, Bacillus atrophaeus XHG-1-3m2, a strain with significant biocontrol potential against Wilsonomyces carpophilus causing shot hole disease in wild apricots, was developed. The study determined the antibacterial activity of the fermentation broth, the optimal fermentation medium composition and conditions, and explored its effectiveness in controlling Wilsonomyces carpophilus. The optimal fermentation medium for strain XHG-1-3m2 comprises 12.5 g/L yeast extract, 12.5 g/L soy peptone, 10.0 g/L sodium chloride, 1 g/L ammonium chloride, 1 g/L potassium dihydrogen phosphate, 1 g/L disodium hydrogen phosphate, and 0.5 g/L magnesium sulfate heptahydrate. With an initial pH of 7.0, a liquid volume of 40%, an inoculum volume of 3%, and shaking incubation at 28 °C for 24 h, the viable cell count reached 14 × 109 CFU/mL. In vitro and in vivo tests on leaves revealed that the fermentation broth and the biocontrol biofertilizer derived from this strain inhibited the leaf lesions caused by Wilsonomyces carpophilus on wild apricots, achieving inhibition rates of 94.62% and 82.46%, respectively.