The unsuitable substitution ratio of fish meal by plant protein will reshape the intestinal microbial composition and intestine immunity. However, previous studies were mostly limited to investigating how different feed or probiotics characterized the microbial composition but ignored the biological interactions between bacteria and host physiology through secondary metabolites. Therefore, this study integrates the apparent indicators monitoring, 16S rDNA sequencing, and metabonomics to systematically investigate the effects of cottonseed protein concentrate (CPC) substitution of fish meal and Bacillus coagulans intervention on gut microbes, secondary metabolites, and intestinal immunity of Macrobrachium rosenbergii. Prawns were fed with three diets for 70 days: HF diets contained 25% fish meal, CPC in LF diets were replaced with 10% fish meal, and LF diets supplemented with 2 × 108 CFU/g diet B. coagulans were designated as BC diets. Results showed that CPC substitution induced a significant decrease in digestive enzyme activities (trypsin and lipase) and gut barrier protein PT-1 expression and a significant increase in γ-GT enzyme activity and inflammatory-related factors (Relish and Toll) expression. B. coagulans treatment mitigated the negative changes of the above indicators. Meanwhile, it significantly improved the expression levels of the barrier factor PT-1, the reparative cytokine IL-22, and Cu/Zn-SOD. CPC substitution resulted in a remarkable downregulated abundance of Firmicutes phyla, Flavobacterium spp., and Bacillus spp. B. coagulans treatment induced the callback of Firmicutes abundance and improved the relative abundance of Sphingomonas, Bacillus, and Ralstonia. Functional prediction indicated that CPC substitution resulted in elevated potential pathogenicity of microbial flora, and B. coagulans reduces the pathogenesis risk. Pearson’s correlation analysis established a significant positive correlation between differential genera (Sphingomonas, Bacillus, and Ralstonia) and secondary metabolites (including sphingosine, dehydrophytosphingosine, amino acid metabolites, etc.). Meanwhile, the latter were significantly associated with intestinal immunoregulation-related genes (Cu/Zn-SOD, IL-22, PT-1, Toll, and Relish). This study indicated that B. coagulans could mediate specific gut microbes and the combined action of multiple functional secondary metabolites to affect intestinal barrier function, digestion, and inflammation. Our study revealed the decisive role of gut microbes and derived secondary metabolites in the model of dietary composition-induced intestinal injury and probiotic treatment from a new perspective.