Gut dysbiosis might underlie the pathogenesis of type 1 diabetes. In mice of the non-obese diabetic (NOD) strain, we found that key features of disease correlated inversely with blood and fecal concentrations of the microbial metabolites acetate and butyrate. We therefore fed NOD mice specialized diets designed to release large amounts of acetate or butyrate after bacterial fermentation in the colon. Each diet provided a high degree of protection from diabetes, even when administered after breakdown of immunotolerance. Feeding mice a combined acetate- and butyrate-yielding diet provided complete protection, which suggested that acetate and butyrate might operate through distinct mechanisms. Acetate markedly decreased the frequency of autoreactive T cells in lymphoid tissues, through effects on B cells and their ability to expand populations of autoreactive T cells. A diet containing butyrate boosted the number and function of regulatory T cells, whereas acetate- and butyrate-yielding diets enhanced gut integrity and decreased serum concentration of diabetogenic cytokines such as IL-21. Medicinal foods or metabolites might represent an effective and natural approach for countering the numerous immunological defects that contribute to T cell-dependent autoimmune diseases.