Background and Objectives. The exact pathological mechanism of Parkinson’s disease (PD) remains elusive, and the existing therapies fail to reverse the disease progression. This study intended to explore the epigenetic anti-inflammatory mechanism of ketogenic diet (KD). Materials and Methods. The neuroprotective effect of ketosis state prior to the onset of PD (preventive KD, KDp) was compared with that receiving KD after the onset (therapeutic KD, KDt) in the lipopolysaccharide- (LPS-) induced rat PD model. A total of 100 rats were randomly assigned to the following 4 groups: sham, LPS, LPS + KDp, and LPS + KDt groups. Results. Significant dopamine deficient behaviors (rotational behavior and contralateral forelimb akinesia), upregulation of proinflammatory mediators (TNF-α, IL-1β, and IL-6), loss of dopaminergic neurons, reduction of mGluR5+ microglia cells, increase of TSPO+ microglia cells, reduction of H3K9 acetylation in the mGluR5 promoter region and mGluR5 mRNA expression, and decline in the phosphorylation levels of Akt/GSK-3β/CREB pathway were observed after the intervention of LPS (
P
<
0.01
). TSPO and DAT PET imaging revealed the increased uptake of 18F-DPA-714 in substantia nigra and decreased uptake of 18F-FP-CIT in substantia nigra and striatum in LPS-treated rats (
P
<
0.001
). These impairments were alleviated by the dietary intervention of KD, especially with the strategy of KDp (
P
<
0.05
). Conclusions. The anti-inflammatory effect of KD on PD was supposed to be related to the modulation of Akt/GSK-3β/CREB signaling pathway mediated by the histone acetylation of mGluR5 promotor region. The KD intervention should be initiated prior to the PD onset in high-risk population to achieve a more favorable outcome.