Abstract The microbiome expresses a variety of functions that influence host biology. The range of functions depends on composition of the microbiome, which itself can change during the lifetime of the host as a consequence of neutral assembly processes, host-mediated selection, and/or environmental conditions. To date, the exact dynamics of microbiome assembly, the underlying determinants as well as the resulting effects on host-associated functions are not always well understood. Here, we used the nematode Caenorhabditis elegans and a defined community of fully sequenced, naturally associated bacteria to study microbiome dynamics and functions across the lifetime of individual hosts under controlled experimental conditions. By applying the neutral and null models, we demonstrate that bacterial community composition initially shows strongly declining levels of stochasticity, which, however, increase during late worm life, suggesting the action of random assembly processes in aged hosts following first colonization of C. elegans . The adult microbiome is enriched in strains of the genera Ochrobactrum and Enterobacter in comparison to the direct substrate and a host-free control environment. Using pathway analysis, metabolic, and ecological modelling, we further found that the lifetime assembly dynamics lead to an increase in gut-associated functions in the host-associated microbiome, possibly indicating that the initially colonizing bacteria are beneficial for the worm. Overall, our study introduces a framework for studying microbiome assembly dynamics based on the stochastic models and inference of functions, yielding new insights into the processes determining host-associated microbiome composition and function. Importance The microbiome plays a crucial role in host biology, with its functions depending on microbiome composition that can change during a host’s lifetime. To date, the dynamics of microbiome assembly and the resulting functions are not well understood. This study introduces a new approach to characterize the functional consequences of microbiome assembly by modelling both, the relevance of stochastic processes and metabolic characteristics of microbial community changes. The approach was applied to experimental time series data, obtained for the microbiome of the nematode Caenorhabditis elegans . The results revealed significant differences in host-associated and environmental microbiomes. Stochastic processes only played a minor role, and the host showed an increase in beneficial bacteria and an enrichment of gut-associated functions, possibly indicating that the host actively shapes composition of its microbiome. Overall, this study provides a framework for studying microbiome assembly dynamics and yields new insights into C. elegans microbiome functions.