Pancreatic β cell plasticity is the primary determinant of disease progression and remission of type 2 diabetes (T2D). However, the dynamic nature of β cell adaptation remains elusive. Here, we establish a mouse model exhibiting the compensation-to-decompensation adaptation of β cell function in response to increasing duration of high-fat diet (HFD) feeding. Comprehensive islet functional and transcriptome analyses reveal a dynamic orchestration of transcriptional networks featuring temporal alteration of chromatin remodeling. Interestingly, prediabetic dietary intervention completely rescues β cell dysfunction, accompanied by a remarkable reversal of HFD-induced reprogramming of islet chromatin accessibility and transcriptome. Mechanistically, ATAC-based motif analysis identifies CTCF as the top candidate driving dietary intervention–induced preservation of β cell function. CTCF expression is markedly decreased in β cells from obese and diabetic mice and humans. Both dietary intervention and AAV-mediated restoration of CTCF expression ameliorate β cell dysfunction ex vivo and in vivo, through transducing the lipid toxicity and inflammatory signals to transcriptional reprogramming of genes critical for β cell glucose metabolism and stress response.