Large randomized controlled trials (RCTs) in preterm infants offer unique opportunities for mechanistic evaluation of the risk factors leading to serious diseases, as well as the actions of interventions designed to prevent them. Necrotizing enterocolitis (NEC) a serious inflammatory gut condition and late-onset sepsis (LOS) are common feeding and nutrition-related problems that may cause death or serious long-term morbidity and are key outcomes in two current UK National Institutes for Health Research (NIHR) trials. Speed of increasing milk feeds trial (SIFT) randomized preterm infants to different rates of increases in milk feeds with a primary outcome of survival without disability at 2 years corrected age. Enteral lactoferrin in neonates (ELFIN) randomizes infants to supplemental enteral lactoferrin or placebo with a primary outcome of LOS. This is a protocol for the mechanisms affecting the gut of preterm infants in enteral feeding trials (MAGPIE) study and is funded by the UK NIHR Efficacy and Mechanistic Evaluation programme. MAGPIE will recruit ~480 preterm infants who were enrolled in SIFT or ELFIN. Participation in MAGPIE does not change the main trial protocols and uses non-invasive sampling of stool and urine, along with any residual resected gut tissue if infants required surgery. Trial interventions may involve effects on gut microbes, metabolites (e.g., short-chain fatty acids), and aspects of host immune function. Current hypotheses suggest that NEC and/or LOS are due to a dysregulated immune system in the context of gut dysbiosis, but mechanisms have not been systematically studied within large RCTs. Microbiomic analysis will use next-generation sequencing, and metabolites will be assessed by mass spectrometry to detect volatile organic and other compounds produced by microbes or the host. We will explore differences between disease cases and controls, as well as exploring the actions of trial interventions. Impacts of this research are multiple: translation of knowledge of mechanisms promoting gut health may explain outcomes or suggest alternate strategies to improve health. Results may identify new non-invasive diagnostic or monitoring techniques, preventative or treatment strategies for NEC or LOS, or provide data useful for risk stratification in future studies. Mechanistic evaluation might be especially informative where there are not clear effects on the primary outcome (ISRCTN 12554594).