The development of nonalcoholic fatty liver disease (NAFLD) has been reported to be caused by sphingolipid family inducing insulin resistance, mitochondrial dysfunction, and inflammation, which can be regulated by multiple sphingolipid metabolic pathways. This study aimed to explore the molecular mechanism of crucial sphingolipid metabolism related genes (SMRGs) in NAFLD. Firstly, the datasets (GSE48452, GSE126848, and GSE63067) from the Gene Expression Omnibus database and sphingolipid metabolism genes (SMGs) from previous research were collected for this study. The differentially expressed genes (DEGs) between different NAFLD and controls were acquired through “limma,” and the SMRGs were authenticated via weighted gene co-expression network analysis (WGCNA). After overlapping the DEGs and SMRGs, the causality between the intersection genes (DE-SMRGs) and NAFLD was explored to sort out the candidate biomarkers by Mendelian randomization (MR) study. The receiver operating characteristic (ROC) curves of candidate biomarkers in GSE48452 and GSE126848 were yielded to determine the biomarkers, followed by the nomogram construction and enrichment analysis. Finally, the immune infiltration analysis, the prediction of transcription factors (TFs) and drugs targeting biomarkers were put into effect. A total of 23 DE-SMRGs were acquired based on the differential analysis and weighted gene co-expression network analysis (WGCNA), of which 3 DE-SMRGs (CD37, CXCL9 and IL7R) were picked out for follow-up analysis through univariate and multivariate MR analysis. The values of area under ROC curve of CD37 and CXCL9 were >0.7 in GSE48452 and GSE126848, thereby being regarded as biomarkers, which were mainly enriched in amino acid metabolism. With respect to the Spearman analysis between immune cells and biomarkers, CD37 and CXCL9 were significantly positively associated with M1 macrophages (P < .001), whose proportion was observably higher in NAFLD patients compared with controls. At last, TFs (ZNF460 and ZNF384) of CD37 and CXCL9 and a total of 79 chemical drugs targeting CD37 and CXCL9 were predicted. This study mined the pivotal SMRGs, CD37 and CXCL9, and systematically explored the mechanism of action of both biomarkers based on the public databases, which could tender a fresh reference for the clinical diagnosis and therapy of NAFLD.