BackgroundSepsis is a serious condition that occurs when the body’s response to infection becomes uncontrolled, resulting in a high risk of death. Despite improvements in healthcare, identifying sepsis early is difficult because of its diverse nature and the absence of distinct biomarkers. Recent studies suggest that 5-methylcytosine (m5C)-related genes play a significant role in immune responses, yet their diagnostic potential in sepsis remains unexplored.MethodsThis research combined and examined four sepsis-related datasets (GSE95233, GSE57065, GSE100159, and GSE65682) sourced from the Gene Expression Omnibus (GEO)database to discover m5C-related genes with differential expression. Various machine learning methods, such as decision tree, random forest, and XGBoost, were utilized in identifying crucial hub genes. Receiver Operating Characteristic (ROC) curve analysis was used to assess the diagnostic accuracy of these genetic markers. Additionally, single-gene enrichment and immune infiltration analyses were conducted to investigate the underlying mechanisms involving these hub genes in sepsis.ResultsThree hub genes, DNA Methyltransferase 1 (DNMT1), tumor protein P53 (TP53), and toll-like receptor 8 (TLR8), were identified and validated for their diagnostic efficacy, showing area under the curve (AUC) values above 0.7 in both test and validation sets. Enrichment analyses revealed that these genes are involved in key pathways such as p53 signaling and Toll-like receptor signaling. Immune infiltration analysis indicated significant correlations between hub genes and various immune cell types, suggesting their roles in modulating immune responses during sepsis.ConclusionThe study highlights the diagnostic potential of m5C-related genes in sepsis and their involvement in immune regulation. These findings offer new insights into sepsis pathogenesis and suggest that DNMT1, TP53, and TLR8 could serve as valuable biomarkers for early diagnosis. Further studies should prioritize validating these biomarkers in clinical settings and investigating their potential for therapy.