Purpose Immune system dysregulation plays a pivotal role in focal segmental glomerulosclerosis (FSGS) and metabolic syndrome (MS). This study aimed to identify core diagnostic genes and potential therapeutic drugs for FSGS patients with MS. Methods We obtained two FSGS and one MS datasets from the GEO database. DEGs and module gene were identified via Limma and WGCNA. Then, functional enrichment analysis, PPI network construction, and machine learning algorithms were applied to identify and analyze immune-associated genes. Afterwards, the nomogram and ROC curve were used to evaluate the diagnostic value and screen core genes. Finally, immune cell dysregulation was investigated in FSGS, and connectivity map (cMAP) analysis was conducted to identify potential therapeutic small molecule compounds. Results MS dataset yielded 756 DEGs, and the integrated FSGS datasets yielded 5257 module genes. 133 genes were identified from the intersection of MS and FSGS. Following the construction of PPI network, 42 node genes were filtered. Then, eight hub genes were obtained through machine learning screening, which were further evaluated by nomogram and diagnostic value. Among them, six core genes had high diagnostic values. FSGS patients had a higher level of resting natural killer cells, monocytes, and activated dendritic cells and meanwhile lower levels of plasma cells, follicular helper T cells, resting dendritic cells, and resting mast cells. Finally, through cMAP analysis, we identified ten small molecule compounds that might work as the potential therapeutic drugs for FSGS patients with MS. Conclusion Six immune-related core genes were identified (STAT3, CX3CR1, CCDC148, TRPC6, CLMP, and CDC42EP1), and ten small molecule compounds were obtained. This study could provide core diagnostic genes and potential therapeutic compounds for FSGS patients with MS.