Our study unveils a spatially defined, microbiome-driven metabolic niche that epigenetically programs CD8+ T-cell exhaustion via the butyrate-HDAC axis, revealing a targetable mechanism to overcome immunotherapy resistance in CRC. Here, HDAC9 is linked to colorectal carcinoma.