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. The gene discussed is TNFRSF1B; the disease is idiopathic pulmonary arterial hypertension.