Through various bioinformatics analyses and machine learning algorithms, we identified 11 immune- and metabolism-related potential diagnostic genes (EVI5L, RNASE2, PARP10, TMEM131, TNFRSF1B, BSDC1, ACOT2, SAC3D1, SLA2, P4HB, and PHF1) for the diagnosis of IPAH and MS, and we herein supply a nomogram for the diagnosis of IPAH in MS patients. This evidence concerns the gene P4HB and myeloid sarcoma.