Microbial dinitrogen (N2) fixation (diazotrophy) is a trait critical for coral holobiont functioning. The contribution of N2 fixation to holobiont nitrogen (N) supply likely depends on the ecological niche of the coral holobiont. Consequently, coral-associated diazotroph communities may exhibit distinct activity patterns across a water depth gradient. We thus compared relative abundances of diazotrophs in the tissues of two common hard coral species, Podabacia sp. and Pachyseris speciosa, along their water depth distribution (10–30 m and 30–50 m, respectively) in the Central Red Sea. The relative gene copy numbers of the nifH gene (i.e., referenced against the eubacterial 16S rRNA gene), as a proxy for N2 fixation potential, were assessed via quantitative PCR. We hypothesized that relative nifH gene copy numbers would decrease with water depth, assuming a related shift from autotrophy to heterotrophy. Findings confirmed this hypothesis and revealed that nifH gene abundances for both corals decreased by ∼97% and ∼90% from the shallowest to the deepest collection site. However, this result was not significant for Pachyseris speciosa due to high biological variability. The observed decrease in nifH gene abundances may be explained by the relative increase in heterotrophy of the coral animal at increasing water depths. Our results underline the importance of interpreting microbial functions and associated nutrient cycling processes within the holobiont in relation to water depth range reflecting steep environmental gradients.