Although diet composition has been implicated as a major factor in the etiology of various gastrointestinal diseases, conclusive evidence remains elusive. This is particularly true in diseases such as necrotizing enterocolitis where breast milk as opposed to commercial formula appears to confer a "protective effect" to the "immature gut." Yet the mechanism by which this occurs continues to remain speculative. In the present study we hypothesize that the basic chemical composition of diet fundamentally selects for specific intestinal microbiota which may help explain disparate disease outcome and therapeutic direction. Complimentary animal and human studies were conducted on young piglets (21 d.)(n = 8) (IACUC protocols 08070 and 08015) and premature infants (adjusted gestational age 34-36 weeks) (n = 11) (IRB Protocol 15895A). In each study, cecal or stool contents from two groups (Breast milk-fed (BF) vs. Formula-fed (FF)) were analyzed by gas chromatography/mass spectrometry (GC/MS) and comprehensive metabolic profiles generated and compared. Concurrently, bacterial community structure was assayed and respective representative microbiota of the groups determined by 16S rRNA gene amplicon pyrosequencing. Statistical modeling and analysis was done using SIMCA-P+ and R software. GC/MS metabolomics identified clear differences between BF and FF groups in the intestinal environment of piglets and humans. Sugars, amino-sugars, fatty acids, especially unsaturated fatty acids, and sterols were identified as being among the most important metabolites for distinguishing between BF and FF groups. Joint analysis of microbiota and metabolomics pinpointed specific sets of metabolites (p < 0.05) associated with the dominant bacterial taxa. The chemical composition of diet appears to have a significant role in defining the microbiota of the immature gut. Tandem analysis of intestinal microbial and metabolic profiles is potentially a powerful tool leading to better understanding of the role of diet in disease perhaps even leading to specific strategies to alter microbial behavior to improve clinical outcome.