By leveraging bioinformatics analysis and machine learning algorithms, we systematically identified five immune-related candidate hub genes (CLEC5A, KLRB1, LCN2, MCEMP1, and MMP9) and provided a nomogram for diagnosing ROP with sepsis. Here, LCN2 is linked to retinopathy of prematurity.