Herb of purple loosestrife (Lythrum salicaria L. from Lythraceae family) (LSH) was used in Europe since ancient times till early-20th century in the therapy of diarrhea and dysentery in human and veterinary medicine. Post-weaning diarrhea is a main problem affecting global piglet production, which leads to significant economic losses because of increased morbidity and mortality, reduced average daily gain, and high antibiotic consumption. Post-weaning diarrhea has various causes, all of which have been linked to imbalances of intestinal microbiota. The aim of the present study was to determine the interaction of LSH with the gut microbiota of healthy post-weaning piglets in order to evaluate its influence on microbiota composition and metabolism as well as production of potentially bioactive postbiotic metabolites from the extract constituents. Ex vivo anaerobic cultures of piglets intestinal microbiota obtained from jejunum, ileum, caecum and distal colon were conducted in various culture media supplemented with LSH. The production of postbiotic metabolites was determined using UPLC-DAD-MSn method. Bacterial genomic DNA was extracted and examined by sequencing by amplification of the 16S rDNA V3-V4 hypervariable regions followed by bioinformatic analysis. The production of SCFA in cultures was determined by GC analysis. Only the caecal and distal colon microbiota was able to hydrolyze and metabolize ellagitannins present in LSH to urolithins. Urolithin M6, M7, urolithin C, A and iso-urolithin A were detected together with a previously not described metabolite originating from the flavogalloyl moiety of C-glucosylic ellagitannins. LSH had no significant influence on microbiota diversity and metabolic activity, but was able to modulate its composition by significant decrease in Collinsella, Senegalimassilia, uncultured bacteria belonging to Porphyromonadaceae, Rikenellaceae RC9 gut group, Mogibacterium, Dorea, Lachnoclostridium, Lachnospiraceae UCG-004 group, Moryella, [Eubacterium] coprostanoligenes, Intestinimonas, Ruminococcaceae UCG-005, uncultured bacteria belonging to Ruminococcaceae, Acidaminococcus and Allisonella, while the relative abundance of Prevotella, Agathobacter, [Eubacterium] hallii group, Lachnospiraceae NK3A20 group, [Ruminococcus] torques group, Catenibacterium, Catenisphaera and Megasphaera increased. Significant correlations between taxa abundance and production of urolithins were determined. In the present study we have shown, that Lythrum salicaria herb fulfills the criteria of a potential candidate for antidiarrheal agent, which could be applied as therapy or prevention of post-weaning diarrhea in piglets. It not only modulates the gut microbiota composition without causing the dysbiosis and impairing metabolic activity, but is also a source of postbiotic metabolites, namely urolithins, which anti-inflammatory properties can be beneficial for gut health of piglets during the weaning period.