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 PTGS2 and metabolic dysfunction-associated steatotic liver disease.