Stem nematode (Ditylenchus destructor Thorne) is considered one of the most economically devastating species affecting sweet potato production. Biocontrol offers a sustainable strategy for nematode control. This study conducted a pot experiment to evaluate the biocontrol efficacy of Paecilomyces lilacinus CS-Z and Bacillus pumilus Y-26 against the stem nematode, as well as to examine their influence on the bacterial communities in the sweet potato rhizosphere. The findings indicated that B.pumilus Y-26 and P.lilacinus CS-Z exhibited respective suppression rates of 82.9% and 85.1% against the stem nematode, while also stimulating sweet potato plant growth. Both high-throughput sequencing and Biolog analysis revealed distinct impacts of the treatments on the bacterial communities. At the phylum level, B.pumilus Y-26 enhanced the abundance of Actinobacteria but reduced the abundance of Cyanobacteria, with P.lilacinus CS-Z exhibiting similar effects. Additionally, the treatment with B.pumilus Y-26 resulted in increased abundances of Crossiella, Gaiella, Bacillus, and Streptomyces at the genus level, while the treatment with P.lilacinus CS-Z showed increased abundances of Crossiella and Streptomyces. In contrast, the abundance of Pseudarthrobacter was reduced in the treatment with B.pumilus Y-26. Conversely, the application of the nematicide fosthiazate exhibited minor influence on the bacterial community. The findings indicated that the application of P.lilacinus CS-Z and B.pumilus Y-26 led to an increase in the relative abundances of beneficial microorganisms, including Gaiella, Bacillus, and Streptomyces, in the rhizosphere soil. In conclusion, P.lilacinus CS-Z and B.pumilus Y-26 demonstrated their potential as environmentally friendly biocontrol agents for managing stem nematode disease of sweet potato.