BackgroundFunctional constipation (FC) in children affects their growth, development and quality of life. L-pipecolic acid (L-PA) was decreased in FC children based on gut microbiome and serum metabolomic. In this study, loperamide-induced constipation in mice was used to evaluate the effects of L-PA on constipated mice.Method26 FC and 28 healthy children were recruited. Stool samples and serum samples were subjected to 16S rDNA sequencing and ultra-performance liquid chromatography/quadrupole time of flight (UPLC-Q/TOF-MS) approach, respectively. A loperamide-induced mouse constipation model was developed, and all mice were randomly divided into control (Con), loperamide (Lop) and L-PA (Lop + L-PA) treatment groups (6 mice per group). The mice in the Lop + L-PA group were given L-PA (250 mg/kg, once a day) and loperamide; the Lop group was given loperamide for 1 week, and the Con group was given saline. The fecal parameters and intestinal motility of mice in each group were detected. serum 5-HT levels and colon 5-HT expression were detected by ELISA and immunohistochemistry, respectively; qRT-PCR was used to detect the expression of AQP3 and 5-HT4R mRNA in each group.Results45 differential metabolites and 18 significantly different microbiota were found in FC children. The α and β diversity of gut microbiota in FC children was significantly reduced. Importantly, serum L-PA was significantly reduced in FC children. The KEGG pathway enrichment were mainly enriched in fatty acid biosynthesis, lysine degradation, and choline metabolism. L-PA was negatively associated withOchrobactrum, and N6, N6, N6-trimethyl-l-lysine was positively associated withPhascolarcrobacterium. In addition, L-PA improved the fecal water content, intestinal transit rate, and increased the serum 5-HT levels in constipated mice. Moreover, L-PA increased the expression of 5-HT4R, reduced AQP3, and regulated constipation-associated genes.ConclusionsGut microbiota and serum metabolites were significantly altered in children with FC. The abundance ofPhascolarctobacteriumandOchrobactrumand serum L-PA content were decreased in FC children. L-PA was found to alleviate the fecal water content, increase intestinal transit rate and the first black stool defecation time. L-PA improved constipation by increasing 5-HT and 5-HT4R expression while down-regulating AQP3 expression.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12866-023-02880-3.