Pediatric sepsis has a very high morbidity and mortality rate. The purpose of this study was to evaluate diagnostic biomarkers and immune cell infiltration in pediatric sepsis. Three datasets (GSE13904, GSE26378, and GSE26440) were downloaded from the gene expression omnibus (GEO) database. After identifying overlapping genes in differentially expressed genes (DEGs) and modular sepsis genes selected via a weighted gene co-expression network (WGCNA) in the GSE26378 dataset, pivotal genes were further identified by using LASSO regression and random forest analysis to construct a diagnostic model. Receiver operating characteristic curve (ROC) analysis was used to validate the efficacy of the diagnostic model for pediatric sepsis. Furthermore, we used qRT-PCR to detect the expression levels of pivotal genes and validate the diagnostic model's ability to diagnose pediatric sepsis in 65 actual clinical samples. Among 294 overlapping genes of DEGs and modular sepsis genes, five pivotal genes (STOM, MS4A4A, CD177, MMP8, and MCEMP1) were screened to construct a diagnostic model of pediatric sepsis. The expression of the five pivotal genes was higher in the sepsis group than in the normal group. The diagnostic model showed good diagnostic ability with AUCs of 1, 0.986, and 0.968. More importantly, the diagnostic model showed good diagnostic ability with AUCs of 0.937 in the 65 clinical samples and showed better efficacy compared to conventional inflammatory indicators such as procalcitonin (PCT), white blood cell (WBC) count, C-reactive protein (CRP), and neutrophil percentage (NEU%). We developed and tested a five-gene diagnostic model that can reliably identify pediatric sepsis and also suggest prospective candidate genes for peripheral blood diagnostic testing in pediatric sepsis patients.