Stem nematode disease can seriously reduce the yield of sweet potato (Ipomoea batatas(L.) Lam). To explore resistance mechanism to stem nematode in sweet potato, transcriptomes and metabolomes were sequenced and compared between two sweet potato cultivars, the resistant Zhenghong 22 and susceptible Longshu 9, at different times after stem nematode infection. In the transcriptional regulatory pathway, mitogen-activated protein kinase signaling was initiated in Zhenghong 22 at the early stage of infection to activate genes related to ethylene production. Stem nematode infection in Zhenghong 22 also triggered fatty acid metabolism and the activity of respiratory burst oxidase in the metabolic pathway, which further stimulated the glycolytic and shikimic pathways to provide raw materials for secondary metabolite biosynthesis. An integrated analysis of the secondary metabolic regulation pathway in the resistant cultivar Zhenghong 22 revealed the accumulation of tryptophan, phenylalanine, and tyrosine, leading to increased biosynthesis of phenylpropanoids and salicylic acid and enhanced activity of the alkaloid pathway. Stem nematode infection also activated the biosynthesis of terpenoids, abscisic acid, zeatin, indole, and brassinosteroid, resulting in improved resistance to stem nematode. Finally, analyses of the resistance regulation pathway and a weighted gene co-expression network analysis highlighted the importance of the genesitf14g17940anditf12g18840, encoding a leucine-rich receptor-like protein and 1-aminocyclopropane-1-carboxylate synthase, respectively. These are candidate target genes for increasing the strength of the defense response. These results provide new ideas and a theoretical basis for understanding the mechanism of resistance to stem nematode in sweet potato.