Six common immune-related genes (PTGS2, FCGR1A, MMP9, VNN3, S100A12, and RRS1) associated with NAFLD and IS were identified using bioinformatics methods and machine learning algorithms, and a diagnostic nomogram of NAFLD patients with IS was established. This evidence concerns the gene S100A12 and metabolic dysfunction-associated steatotic liver disease.