The gut microbiota may modulate the disposition and toxicity of environmental contaminants within a host but, conversely, contaminants may also impact gut bacteria. Such contaminant-gut microbial connections, which could lead to alteration of host health, remain poorly known and are rarely studied in free-ranging wildlife. The polar bear (Ursus maritimus) is a long-lived, wide-ranging apex predator that feeds on a variety of high trophic position seal and cetacean species and, as such, is exposed to among the highest levels of biomagnifying contaminants of all Arctic species. Here, we investigate associations between mercury (THg; a key Arctic contaminant), diet, and the diversity and composition of the gut microbiota of polar bears inhabiting the southern Beaufort Sea, while accounting for host sex, age class and body condition. Bacterial diversity was negatively associated with seal consumption and mercury, a pattern seen for both Shannon and Inverse Simpson alpha diversity indices (adjusted R2 = 0.35, F1,18 = 8.00, P = 0.013 and adjusted R2 = 0.26, F1,18 = 6.04, P = 0.027, respectively). No association was found with sex, age class or body condition of polar bears. Bacteria known to either be involved in THg methylation or considered to be highly contaminant resistant, including Lactobacillales, Bacillales and Aeromonadales, were significantly more abundant in individuals that had higher THg concentrations. Conversely, individuals with higher THg concentrations showed a significantly lower abundance of Bacteroidales, a bacterial order that typically plays an important role in supporting host immune function by stimulating intraepithelial lymphocytes within the epithelial barrier. These associations between diet-acquired mercury and microbiota illustrate a potentially overlooked outcome of mercury accumulation in polar bears.