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. 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. To achieve these results, 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 demonstrate that our probabilistic machine learning method achieves scalability while maintaining interpretability on these data, by inferring a small number of modules of bacterial taxa that share common interactions and responses to perturbations. 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.