Primary sclerosing cholangitis (PSC) is an immune-mediated disease of the bile ducts that co-occurs with inflammatory bowel disease (IBD) in almost 90% of cases. Colorectal cancer is a major complication of patients with PSC and IBD, and these patients are at a much greater risk compared to patients with IBD without concomitant PSC. Combining flow cytometry, bulk and single-cell transcriptomics, and T and B cell receptor repertoire analysis of right colon tissue from 65 patients with PSC, 108 patients with IBD and 48 healthy individuals we identified a unique adaptive inflammatory transcriptional signature associated with greater risk and shorter time to dysplasia in patients with PSC. This inflammatory signature is characterized by antigen-driven interleukin-17A (IL-17A)+ forkhead box P3 (FOXP3)+ CD4 T cells that express a pathogenic IL-17 signature, as well as an expansion of IgG-secreting plasma cells. These results suggest that the mechanisms that drive the emergence of dysplasia in PSC and IBD are distinct and provide molecular insights that could guide prevention of colorectal cancer in individuals with PSC.