Objective Ankylosing spondylitis (AS) is a common, highly heritable immune‐mediated arthropathy that occurs in genetically susceptible individuals exposed to an unknown but likely ubiquitous environmental trigger. There is a close relationship between the gut and spondyloarthritis, as exemplified in patients with reactive arthritis, in whom a typically self‐limiting arthropathy follows either a gastrointestinal or urogenital infection. Microbial involvement in AS has been suggested; however, no definitive link has been established. The aim of this study was to determine whether the gut in patients with AS carries a distinct microbial signature compared with that in the gut of healthy control subjects. Methods Microbial profiles for terminal ileum biopsy specimens obtained from patients with recent‐onset tumor necrosis factor antagonist–naive AS and from healthy control subjects were generated using culture‐independent 16S ribosomal RNA gene sequencing and analysis techniques. Results Our results showed that the terminal ileum microbial communities in patients with AS differ significantly ( P < 0.001) from those in healthy control subjects, driven by a higher abundance of 5 families of bacteria ( Lachnospiraceae [ P = 0.001], Ruminococcaceae [ P = 0.012], Rikenellaceae [ P = 0.004], Porphyromonadaceae [ P = 0.001], and Bacteroidaceae [ P = 0.001]) and a decrease in the abundance of 2 families of bacteria ( Veillonellaceae [ P = 0.01] and Prevotellaceae [ P = 0.004]). Conclusion We show evidence for a discrete microbial signature in the terminal ileum of patients with AS compared with healthy control subjects. The microbial composition was demonstrated to correlate with disease status, and greater differences were observed between disease groups than within disease groups. These results are consistent with the hypothesis that genes associated with AS act, at least in part, through effects on the gut microbiome.