Malnutrition remains a leading contributor to the morbidity and mortality of children under the age of 5 years and can weaken the immune system and increase the severity of concurrent infections. Livestock milk with the protective properties of human milk is a potential therapeutic to modulate intestinal microbiota and improve outcomes. The aim of this study was to develop an infection model of childhood malnutrition in the pig to investigate the clinical, intestinal and microbiota changes associated with malnutrition and enterotoxigenic Escherichia coli (ETEC) infection and to test the ability of goat milk and milk from genetically engineered goats expressing the antimicrobial human lysozyme (hLZ) milk to mitigate these effects. Pigs were weaned onto a protein–energy-restricted diet and after 3 weeks were supplemented daily with goat, hLZ or no milk for a further 2 weeks and then challenged with ETEC. The restricted diet enriched faecal microbiota in Proteobacteria as seen in stunted children. Before infection, hLZ milk supplementation improved barrier function and villous height to a greater extent than goat milk. Both goat and hLZ milk enriched for taxa (Ruminococcaceae) associated with weight gain. Post-ETEC infection, pigs supplemented with hLZ milk weighed more, had improved Z-scores, longer villi and showed more stable bacterial populations during ETEC challenge than both the goat and no milk groups. This model of childhood disease was developed to test the confounding effects of malnutrition and infection and demonstrated the potential use of hLZ goat milk to mitigate the impacts of malnutrition and infection.