The gut microbiota of preterm infants develops predictably1-7, with pioneer species colonizing the gut after birth, followed by an ordered succession of microorganisms. The gut microbiota is vital to the health of preterm infants8,9, but the forces that shape these predictable dynamics of microbiome assembly are unknown. The environment, the host and interactions between microorganisms all potentially shape the dynamics of the microbiota, but in such a complex ecosystem, identifying the specific role of any individual factor is challenging10-14. Here we use multi-kingdom absolute abundance quantification, ecological modelling and experimental validation to address this challenge. We quantify the absolute dynamics of bacteria, fungi and archaea in a longitudinal cohort of 178 preterm infants. We uncover microbial blooms and extinctions, and show that there is an inverse correlation between bacterial and fungal loads in the infant gut. We infer computationally and demonstrate experimentally in vitro and in vivo that predictable assembly dynamics may be driven by directed, context-dependent interactions between specific microorganisms. Mirroring the dynamics of macroscopic ecosystems15-17, a late-arriving member of the microbiome, Klebsiella, exploits the pioneer microorganism, Staphylococcus, to gain a foothold within the gut. Notably, we find that interactions between different kingdoms can influence assembly, with a single fungal species-Candida albicans-inhibiting multiple dominant genera of gut bacteria. Our work reveals the centrality of simple microbe-microbe interactions in shaping host-associated microbiota, which is critical both for our understanding of microbiota ecology and for targeted microbiota interventions.