Recent research has demonstrated the potential of fecal microbiome analysis using machine learning (ML) in the diagnosis of inflammatory bowel disease (IBD), mainly Crohn’s disease (CD) and ulcerative colitis (UC). This study employed the sparse partial least squares discriminant analysis (sPLS-DA) ML technique to develop a robust prediction model for distinguishing among CD, UC, and healthy controls (HCs) based on fecal microbiome data. Using data from multicenter cohorts, we conducted 16S rRNA gene sequencing of fecal samples from patients with CD (n = 671) and UC (n = 114) while forming an HC cohort of 1462 individuals from the Kangbuk Samsung Hospital Healthcare Screening Center. A streamlined pipeline based on HmmUFOTU was used. After a series of filtering steps, 1517 phylotypes and 1846 samples were retained for subsequent analysis. After 100 rounds of downsampling with age, sex, and sample size matching, and division into training and test sets, we constructed two binary prediction models to distinguish between IBD and HC and CD and UC using the training set. The binary prediction models exhibited high accuracy and area under the curve (for differentiating IBD from HC (mean accuracy, 0.950; AUC, 0.992) and CD from UC (mean accuracy, 0.945; AUC, 0.988)), respectively, in the test set. This study underscores the diagnostic potential of an ML model based on sPLS-DA, utilizing fecal microbiome analysis, highlighting its ability to differentiate between IBD and HC and distinguish CD from UC.