Background: Maternal high-fat diet (MHFD) has been shown to increase susceptibility to neurological disease in later offspring, but the underlying mechanism is not clear. Fibroblast growth factor 21 (FGF21) has been reported to have a neuroprotective effect in stroke, but its mechanism of action remains unknown. In this study, we investigated the mechanism of the effect of MHFD on stroke in offspring in adulthood and the mechanism by which FGF21 acts on stroke and restores neurological function.Methods: We performed transcriptome sequencing analysis on D21 neonatal rats. Bodyweight and blood indicators were recorded in the adult rats after MHFD. FGF21 was administered 7 h after photochemical modeling twice a day for three consecutive days.Results: We found numerous mRNA changes between the MHFD group and a normal maternal normal diet (MND) group at D21, including genes related to astrocyte and PI3K/Akt pathways. The body weight, blood glucose, and triglycerides of the MHFD offspring were higher, ischemic lesions were larger, the number of activated astrocytes was lower, and the neurological function score was worse than that of the MND group. After FGF21 administration, WB and qPCR analyses showed that astrocytes and the PI3K/Akt pathway were upregulated, while NF-κB and inflammatory cytokines expression were inhibited in stroke and peri-stroke regions.Conclusion: Taken together, we conclude that MHFD alters the characteristics of astrocytes and other transcriptome changes in their offspring, leading to a worse prognosis of stroke, while FGF21 plays a neuroprotective role by inhibiting NF-κB and inflammatory factors and activating the PI3K/Akt pathway and activating more astrocytes in the MND group than the MHFD group.