Diabetic cognitive impairment (DCI) is a common diabetic complication characterized by learning and memory deficits. In diabetic patients, hyperactivated hypothalamic-pituitary-adrenal (HPA) axis leads to abnormal increase of glucocorticoids (GCs), which causes the damage of hippocampal neurons and cognitive impairment. In this study we investigated the cognition-improving effects of a non-steroidal glucocorticoid receptor (GR) antagonist 5-chloro-N-[4-chloro-3-(trifluoromethyl) phenyl]thiophene-2-sulfonamide (FX5) in diabetic mice. Four weeks after T1DM or T2DM was induced, the mice were administered FX5 (20, 40 mg·kg−1·d−1, i.g.) for 8 weeks. Cognitive impairment was assessed in open field test, novel object recognition test, Y-maze test, and Morris water maze test. We showed that FX5 administration significantly ameliorated the cognitive impairments in both type 1 and 2 diabetic mice. Similar cognitive improvement was observed in diabetic mice following brain GR-specific knockdown by injecting AAV-si-GR. Moreover, AAV-si-GR injection occluded the cognition-improving effects of FX5, suggesting that FX5 functioning as a non-steroidal GR antagonist. In PA-treated primary neurons (as DCI model in vitro), we demonstrated that FX5 (2, 5, 10 μM) dose-dependently ameliorated synaptic impairment via upregulating GR/BDNF/TrkB/CREB pathway, protected against neuronal apoptosis through repressing GR/PI3K/AKT/GSK3β-mediated tauopathy and subsequent endoplasmic reticulum stress. In LPS-treated primary microglia, FX5 dose-dependently inhibited inflammation through GR/NF-κB/NLRP3/ASC/Caspase-1 pathway. These beneficial effects were also observed in the hippocampus of diabetic mice following FX5 administration. Collectively, we have elucidated the mechanisms underlying the beneficial effects of non-steroidal GR antagonist FX5 on DCI and highlighted the potential of FX5 in the treatment of the disease.