Dynamical systems models are a powerful tool for analyzing interactions in ecosystems and their intrinsic properties such as stability and resilience. The human intestinal microbiome is a complex ecosystem of hundreds of microbial species, critical to our health, and when in a disrupted state termed dysbiosis, is involved in a variety of diseases. Although dysbiosis remains incompletely understood, it is not caused by single pathogens, but instead involves broader disruptions to the microbial ecosystem. Dynamical systems models would thus seem a natural approach for analyzing dysbiosis, but have been hampered by the scale of the human gut microbiome, which constitutes hundreds of thousands of potential ecological interactions, and is profiled using sparse and noisy measurements. Here we introduce a combined experimental and statistical machine learning approach that overcomes these challenges to provide the first comprehensive and predictive model of microbial dynamics at ecosystem-scale. Our statistical machine learning approach, named MDSINE2 (Microbial Dynamical Systems INference Engine 2), is a fully Bayesian nonparametric model with an associated efficient inference algorithm. Our contributions include a new type of dynamical systems model for microbial dynamics based on what we term interaction modules, or learned clusters of latent variables with redundant interaction structure (reducing the expected number of interaction coefficients from O(n^2) to O((log n)^2)) and a fully Bayesian formulation of our stochastic dynamical systems model that propagates measurement and latent state uncertainty throughout the model. For our experiments we created cohorts of “humanized” gnotobiotic mice via fecal transplantation from healthy and dysbiotic human donors, and subjected mice to dietary and antibiotic perturbations, in the densest temporal interventional study to date. We show that dysbiosis is characterized by competitive cycles of interactions among microbial species, in contrast to the healthy microbiome, which is stabilized by chains of positive interactions initiated by resistant starch-degrading bacteria. Our findings provide new insights into the mechanisms of microbial dysbiosis, have potential implications for therapies to restore the microbiome to treat disease, and moreover offer a powerful framework for analyzing other complex ecosystems.