In conclusion, CEBPD, H4C11, CEBPB, GATA3, and KLF4 were identified as diagnostic biomarkers of NAFLD by machine learning algorithms and were related to immune cell infiltration in NAFLD. This evidence concerns the gene CEBPD and metabolic dysfunction-associated steatotic liver disease.