Here, through integrated bioinformatics analyses and machine learning methods, we identified two pivotal immune‐associated candidate genes (Sytl4 and Kcnc2) and constructed a nomogram for diagnosing the obesity‐associated risk in the offspring of mothers with obesity. Here, KCNC2 is linked to obesity due to melanocortin 4 receptor deficiency.