Sepsis-associated encephalopathy (SAE) is the cognitive impairment resulting from sepsis and is associated with increased morbidity and mortality. Hydrogen has emerged as a promising therapeutic agent to alleviate SAE. The mechanism, however, remains unclear. This research aimed to determine whether hydrogen alleviates SAE by regulating microglia polarization and whether it is mediated by the mammalian target of rapamycin (mTOR)-autophagy pathway. Septic models were established by cecal ligation and puncture (CLP) performed on mice. The Morris Water Maze was used to evaluate cognitive function. M1/M2 microglia polarization was assessed by immunofluorescence. Inflammatory cytokines were determined by ELISA. Septic cell models were established using BV-2 cells incubated with 1 μg/ml lipopolysaccharide (LPS). M1/M2 microglia polarization was assessed by flow cytometry. Inflammatory cytokines from culture medium supernatant were determined by ELISA, and associated protein expression levels of mTOR-autophagy pathway were assessed by Western blot. Hydrogen inhalation attenuated sepsis-induced cognitive impairment with improved escape latency, time spent in the target platform quadrant and number of times crossing the target platform. In both animal and cell research, hydrogen reduced TNF-α, IL-6 and HMGB1 levels and M1 polarization, but increased IL-10 and TGF-β levels and M2 polarization. Hydrogen treatment decreased the ratio of p-mTOR/mTOR and the expression of p62 and increased the ratio of p-AMPK/AMPK, LC3II/LC3I and the expression of TREM-2 and Beclin-1 in LPS-treated BV-2 cells. MHY1485, an mTOR activator, abolished the protective effects of hydrogen in vitro. Taken together, these results demonstrated that hydrogen attenuated sepsis-induced neuroinflammation by modulating microglia polarization, which was mediated by the mTOR-autophagy signaling pathway.