Background. Interstitial cystitis/bladder pain syndrome (IC/BPS) is a chronic, severely distressing clinical syndrome characterized by bladder pain and pressure perceptions. The origin and pathophysiology of IC/BPS are currently unclear, making it difficult to diagnose and formulate successful treatments. Our study is aimed at investigating the role of immune-related genes in the diagnosis, progression, and therapy of IC/BPS. Method. The gene expression datasets GSE11783, GSE11839, GSE28242, and GSE57560 were retrieved from the GEO database for further analysis. Immune-related IC/BPS differentially expressed genes (DEGs) were identified by limma. Three distinct machine learning approaches, least absolute shrinkage and selection operator (LASSO), support vector machine–recursive feature elimination (SVM-RFE), and random forest (RF), were used to find the immune-related IC characteristic genes. Nomogram and receiving operator curves (ROC) were plotted to measure characteristic effectiveness. Using the CMap database and the molecular docking approach, potential small-molecule medicines were found and verified. Consensus cluster analysis was also performed to separate the IC/BPS samples into immunological subtypes. Results. A total of 24 immune-related IC/BPS-DEGs were identified. When compared to the normal control group, the IC/BPS cohort had significantly more immune cell infiltration. Integrative machine learning methods discovered 5 IC/BPS characteristic genes (RASGRP1, PPBP, RBP4, CR2, and PROS2) that may predict IC/BPS diagnosis and immune cell infiltration. Furthermore, two immunological subgroups with substantial variations in immune cell infiltration across IC/BPS samples were identified, which were named cluster1 and cluster2, with the hallmark genes having greater expression in cluster2. Finally, bumetanide was shown to have the potential to be a medication for the treatment of IC/BPS, and it performed well in terms of its molecular binding with RASGRP1. Conclusion. We found and validated 5 immune-related IC/BPS genes (RASGRP1, PPBP, RBP4, CR2, and PROS2) and 2 IC/BPS immune subtypes. In addition, bumetanide was discovered to be a potential drug for treating IC/BPS, which may provide new insight into the diagnosis and immune therapy of IC/BPS patients.