Clinical trials have demonstrated the health benefits of intermittent fasting (IF). However, the potential mechanism of IF in alleviating dextran sulfate sodium (DSS)-induced colitis is not fully understood. The present study was mainly designed to explore the dynamic changes in the gut microbiota and metabolome after short-term (2 weeks) or long-term (20 weeks) IF and therefore clarify the potential mechanisms by which IF ameliorates DSS-induced colitis in a murine model. Thirty-two C57BL/6 male mice were equally divided into four groups and underwent IF intervention for 2 weeks (SIF group, n = 8), 20 weeks (LIF group, n = 8), or were allowed free access to food for 2 weeks (SAL group, n = 8) or 20 weeks (LAL group, n = 8). The thirty-two C57BL/6 male mice were accepted for the diet intervention of 2 weeks of IF or fed ad libitum. Colitis was induced by drinking 2% DSS for 7 days. Our findings showed that short-term IF prominently elevates the abundance of Bacteroides, Muibaculum and Akkermansia (p < 0.001, p < 0.001, p < 0.001, respectively), and decreased the abundance of Ruminiclostridium (p < 0.05). Long-term IF, however, decreased the abundance of Akkermansia and obviously increased the abundance of Lactobacillus (p < 0.05, p < 0.001, respectively). Metabolites mainly associated with nucleoside, carbohydrate, amino acid, bile acid, fatty acid, polyol, steroid and amine metabolism were identified in the faeces using untargeted GC/MS. In particular, inosine was extremely enriched after short-term IF and long-term IF (p < 0.01, p < 0.01, respectively); butyrate, 2-methyl butyric acid and valeric acid were significantly decreased after short-term IF (p < 0.001, p < 0.001, p < 0.01, respectively); and 2-methyl butyric acid was significantly increased after long-term IF (p < 0.001). The abundance of lithocholic acid (LCA), one of the secondary bile acids, increased significantly after short-term and long-term IF based on UPLC−MS/MS (p < 0.001, p < 0.5, respectively). Of note, IF markedly mitigated DSS-induced acute colitis symptoms and down-regulated pro-inflammatory cytokines IL-1α, IL-6, keratinocyte-derived chemokine (KC) and G-CSF levels in the serum (p < 0.01, p < 0.001, p < 0.05, p < 0.001, respectively). Furthermore, a correlation analysis indicated that the disease activity index (DAI) score and serum levels of IL-1α, IL-6, KC, and G-CSF were negatively correlated with the relative abundance of Akkermansia and the faecal metabolites LCA and inosine. This study confirmed that IF altered microbiota and reprogramed metabolism, which was a promising development in the attempt to prevent DSS-induced colitis. Moreover, our findings provide new insights regarding the correlations among the mucosal barrier dysfunction, metabolome, and microbiome.