Gut bacteria modulate the response to immune checkpoint blockade (ICB) treatment in cancer, but the effect of diet and supplements on this interaction is not well studied. We assessed fecal microbiota profiles, dietary habits, and commercially available probiotic supplement use in melanoma patients and performed parallel preclinical studies. Higher dietary fiber was associated with significantly improved progression-free survival in 128 patients on ICB, with the most pronounced benefit observed in patients with sufficient dietary fiber intake and no probiotic use. Findings were recapitulated in preclinical models, which demonstrated impaired treatment response to anti-programmed cell death 1 (anti-PD-1)-based therapy in mice receiving a low-fiber diet or probiotics, with a lower frequency of interferon-g-positive cytotoxic T cells in the tumor microenvironment. Together, these data have clinical implications for patients receiving ICB for cancer.