Diazotrophic communities contribute inorganic nitrogen for the primary productivity of the marine environment by biological nitrogen fixation (BNF). They play a vital role in the biogeochemical cycle of nitrogen in the marine ecological environment. However, there is still an incomplete understanding of BNF and diazotrophs in artificial seaweed farms. Therefore, this study comprehensively investigated the temporal variations of BNF associated with Gracilariopsis lemaneiformis, as well as the diazotrophic communities associated with macroalgae and its surrounding seawater. Our results revealed that a total of 13 strains belonging to Proteobacteria and Bacteroidetes were identified as N2-fixing bacteria using azotobacter selective solid medium and nifH gene cloning. Subsequently, BNF and diazotrophic communities were characterized using the acetylene reduction method and high-throughput sequencing of the nifH gene, respectively. The results showed that nitrogenase activity and nifH gene abundance of epiphytic bacteria on G. lemaneiformis varied significantly among four different cultivation periods, i.e., Cultivation Jan. (CJ), Cultivation Feb. (CF), Cultivation Mar. (CM), Cultivation Apr. (CA). Among them, the nitrogenase activity and nifH gene abundance of epiphytic bacteria on G. lemaneiformis in CM were significantly higher than those in CJ, CF, and CA, indicating that the BNF of eiphytic bacteria on G. lemaneiformis was markedly enhanced. Combined with the data on environmental factors, it was found that the low concentration of nitrogen and phosphorus in CM might considerably boost the BNF of epiphytic bacteria in G. lemaneiformis. The sequencing results of the nifH gene showed that the α-diversity of diazotrophic communities associated with G. lemaneiformis and seawater in CM was higher than that in other cultivation periods. In addition, the diazotrophic communities on G. lemaneiformis were significantly different in CJ, CF, CM, and CA, and they were significantly diverse from diazotrophic communities in seawater. LEfSe analysis indicated that Rhodobacterales, Hyphomonadaceae, Robiginitomaculum, and Robiginitomaculum antarcticum within α-proteobacteria played a remarkable role in BNF in response to nitrogen nutrient deficiency. Taken together, these results provide a unique insight into the interaction between macroalgae and its epiphytic bacteria and lay a foundation for further research on the mechanism of action of nitrogen-cycling microorganisms associated with macroalgae.