As a potential antibiotic alternative, macleaya cordata extract (MCE) has anti-inflammatory, antioxidant, and antimicrobial properties. This study was conducted to assess the impact of MCE supplementation on the gut microbiota and its interplay with the host in young goats. Thirty female black goats with similar body weight (5.63 ± 0.30kg) were selected and randomly allotted into one of three diets: a control diet (Control), a control diet with antibiotics (Antibiotics, 21 mg/kg/day vancomycin and 42 mg/kg/day neomycin), and a control diet with MCE (MCE, 3.75% w/w premix). Principal coordinate analysis of the microbial community showed that samples of Antibiotic clustered separately from both Control and MCE (p<0.001). The random forest analysis revealed that, in comparison to the Control group, the impact of Antibiotics on the microbiota structure was more pronounced than that of MCE (number of featured microbiota, 13 in Antibiotics and >6 in MCE). In addition, the pathways of significant enrichment either from DEGs between Antibiotics and Control or from DEGs between MCE and Control were almost identical, including Th17 cell differentiation, butanoate metabolism, T-cell receptor signaling pathway, intestinal immune network for IgA production, antigen processing and presentation, and ABC transporters. Furthermore, an integrative analysis indicated that significant positive correlations (p < 0.05) were observed between HEPHL1 and the featured biomarkers Atopostipes, Syntrophococcus, Romboutsia, and Acinetobacter in the MCE group. Conversely, several significant negative correlations (p < 0.05) were identified between HEPHL1 and the featured biomarkers Clostridium_XlVa, Phascolarctobacterium, Desulfovibrio, Cloacibacillus, Barnesiella, Succinatimonas, Alistipes, Oscillibacter, Ruminococcus2, and Megasphaera in the Antibiotics group. Collectively, the analysis of microbiome-transcriptome data revealed that dietary supplementation with MCE produced significant alterations in multiple immune pathways, while having minimal impact on the microbial structure.