Thermodynamic models predict that H2 is energetically favorable for seafloor microbial life, but how H2 affects anabolic processes in seafloor-associated communities is poorly understood. Here, we used quantitative 13C DNA stable isotope probing (qSIP) to quantify the effect of H2 on carbon assimilation by microbial taxa synthesizing 13C-labeled DNA that are associated with partially serpentinized peridotite rocks from the equatorial Mid-Atlantic Ridge. The rock-hosted seafloor community was an order of magnitude more diverse compared to the seawater community directly above the rocks. With added H2, peridotite-associated taxa increased assimilation of 13C-bicarbonate and 13C-acetate into 16S rRNA genes of operational taxonomic units by 146% (±29%) and 55% (±34%), respectively, which correlated with enrichment of H2-oxidizing NiFe-hydrogenases encoded in peridotite-associated metagenomes. The effect of H2 on anabolism was phylogenetically organized, with taxa affiliated with Atribacteria, Nitrospira, and Thaumarchaeota exhibiting the most significant increases in 13C-substrate assimilation in the presence of H2. In SIP incubations with added H2, an order of magnitude higher number of peridotite rock-associated taxa assimilated 13C-bicarbonate, 13C-acetate, and 13C-formate compared to taxa that were not associated with peridotites. Collectively, these findings indicate that the unique geochemical nature of the peridotite-hosted ecosystem has selected for H2-metabolizing, rock-associated taxa that can increase anabolism under high H2 concentrations. Because ultramafic rocks are widespread in slow-, and ultraslow-spreading oceanic lithosphere, continental margins, and subduction zones where H2 is formed in copious amounts, the link between H2 and carbon assimilation demonstrated here may be widespread within these geological settings.