One of the most crucial struggles for the aquatic ecosystem and modern society is environmental pollution. New approaches, such as the environmental DNA Metagenomic approach, have become a powerful tool to investigate the abundance and diversity of sediment-associated microbiota communities. Nevertheless, information on the response of microbial populations to heavy metals (HMs) in the coastal sediments of Taiwan is scarce. 44 sediment samples were collected from the Siangshan wetland in Taiwan (Taiwan Strait) at two different depths (surface and sub-surface) to measure various environmental variables viz., heavy metals, total organic matters, and sediment composition. Moreover, the abundance and structure of sediment-associated microbiota were examined using high-throughput 16S rRNA gene (V3-V4) next-generation sequencing, to explore the response of the microbiota community to environmental variables. According to the computed pollution indices viz., sediment quality guidelines (SQGs), enrichment factor (EF), geo-accumulation index (Igeo), pollution index (PI), and pollution load index (PLI), the studied sites were classified as unpolluted, moderately polluted, and extremely polluted. Our results revealed that the majority of high-quality reads were assigned to bacteria (~ 95.05%), Archaea (~ 4.83%), and 0.13% were unclassified. Study sites were dominated largely by Proteobacteria with a total of 38.02% across all sediment samples, followed by Bacteroidota (7.18%), Desulfobacterota (6.97%), Actinobacterota (6.68%), Cyanobacteria (5.84%), Chloroflexota (4.18%), Planctomycetota (4.16%), and Firmicutes (3.69%). Beta diversity (Non-metric dimensional scaling analysis, nMDS) explained that surface and sub-surface groups had significantly different microbial community compositions (p = 0.01). Meanwhile, polluted sites exhibited more richness and diversity than unpolluted sites. Redundancy analysis (RDA) illustrated that Mn, Cu, Al, Co, Ni, Sand, and Cr had a sizable effect on the structure of microbiota communities (at the class level). This work highlights the potential responsibility of environmental variables in shaping the sedimentary microbiota of the Siangshan wetland via integrating various ecological variables with alteration of the microbiota composition.