Sweet potato stem nematode disease is a devastating disease, which seriously affects the yield and quality of sweet potato (Ipomoea batatas (L.) Lam.). At present, soil treatment with pesticides is mainly used to prevent sweet potato stem nematode disease. In this study, Illumina MiSeq high‐throughput sequencing technology was used to analyze the diversity of soil bacterial and fungal communities treated with different pesticides. At the same time, high performance liquid chromatography was used to determine the pesticide residues in soil and sweet potato, and the impact on sweet potato yield was investigated. Kruskal–Wallis test was used to analyze the four α‐diversity indexes of soil under different pesticide treatments, and the differences were not significant (p > 0.05), indicating that there was no significant difference in the diversity and abundance of bacterial and fungal communities in soil under different pesticide treatments. The results of principal coordinate analysis showed that there was no significant difference in bacterial and fungal community structure among different pesticide treatments (p > 0.05). Pesticide residue analysis and yield statistics of sweet potato showed that the residual amount of three kinds of pesticides in sweet potato did not exceed the maximum limit stipulated by the current National Standards for Food safety (GB2763‐2021). When 5% chlorpyrifos phoxim particles were applied at 15.18 kg/acre, sweet potato was unaffected by pests and diseases basically, and the yield was the highest.