Background: 5-methylcytosine (m5C) RNA methylation plays a significant role in several human diseases. However, the functional role of m5C in type 2 diabetes (T2D) remains unclear.Methods: The merged gene expression profiles from two Gene Expression Omnibus (GEO) datasets were used to identify m5C-related genes and T2D-related differentially expressed genes (DEGs). Least-absolute shrinkage and selection operator (LASSO) regression analysis was performed to identify optimal predictors of T2D. After LASSO regression, we constructed a diagnostic model and validated its accuracy. Gene ontology (GO) and Kyoto Encyclopedia of Genes and Genomes (KEGG) analyses were conducted to confirm the biological functions of DEGs. Gene Set Enrichment Analysis (GSEA) was used to determine the functional enrichment of molecular subtypes. Weighted gene co-expression network analysis (WGCNA) was used to select the module that correlated with the most pyroptosis-related genes. Protein-protein interaction (PPI) network was established using the STRING database, and hub genes were identified using Cytoscape software. The competitive endogenous RNA (ceRNA) interaction network of the hub genes was obtained. The CIBERSORT algorithm was applied to analyze the interactions between hub gene expression and immune infiltration.Results: m5C-related genes were significantly differentially expressed in T2D and correlated with most T2D-related DEGs. LASSO regression showed that ZBTB4 could be a predictive gene for T2D. GO, KEGG, and GSEA indicated that the enriched modules and pathways were closely related to metabolism-related biological processes and cell death. The top five genes were identified as hub genes in the PPI network. In addition, a ceRNA interaction network of hub genes was obtained. Moreover, the expression levels of the hub genes were significantly correlated with the abundance of various immune cells.Conclusion: Our findings may provide insights into the molecular mechanisms underlying T2D based on its pathophysiology and suggest potential biomarkers and therapeutic targets for T2D.