It's been known for many years that the(the bacterial and viral components of gut contents) can affect the physical wellbeing of mammals, including humans.
It's recently been suggested that the micro-organisms might also be able to affect humans' psychological balances as well.
The new field of 'Psychobiotics' (named in 2012) studies such effects.
Animal studies (i.e. rodents) have shown that gut bacteria can apparently alter animals' 'mood'. ( See: Psychobiotics and the Manipulation of Bacteria–Gut–Brain Signals in Trends in Neurosciences 2016 Nov; 39(11): 763–781).
Further, it's known that bacteria can and do produce a wide range of chemical by-products that happen to be classed as zoological 'neurotransmitters' :
“Several molecules with neuroactive functions such as gamma-aminobutyric acid (GABA), serotonin, catecholamines and acetylcholine have been reported to be microbially-derived, many of which have been isolated from bacteria within the human gut.”
Source: Bacterial Neuroactive Compounds Produced by Psychobiotics in Microbial Endocrinology: The Microbiota-Gut-Brain Axis in Health and Disease pp 221-239
Researchers are divided, however, on the validity of studies to date :
“Whether bacteria might play a role in the gut-brain axis is under research. However, as of 2018, there is a paucity of randomized controlled trials testing the effects of live, ingested bacterial strains on clear mental health outcomes, and those that have been done provide inconclusive results when viewed in aggregate.”
Further research is needed to establish whether psychobiotic approaches could be applicable in the treatment of psychiatric problems - as well as in the maintenance of day-to-day psychological balance.