This study investigated the effect of nitrogen application on the rhizosphere soil microenvironment of sunflower and clarified the relationship between ammonium assimilation and the microenvironment. In a field experiment high (HN, 190 kg/hm2), medium (MN, 120 kg/hm2) and low nitrogen (CK, 50 kg/hm2) treatments were made to replicate plots of sunflowers using drip irrigation. Metagenomic sequencing was used to analyze the community structure and functional genes involved in the ammonium assimilation pathway in rhizosphere soil. The findings indicated that glnA and gltB played a crucial role in the ammonium assimilation pathway in sunflower rhizosphere soil, with Actinobacteria and Proteobacteria being the primary contributors. Compared with CK treatment, the relative abundance of Actinobacteria increased by 15.57% under MN treatment, while the relative abundance decreased at flowering and maturation stages. Conversely, the relative abundance of Proteobacteria was 28.57 and 61.26% higher in the MN treatment during anthesis and maturation period, respectively, compared with the CK. Furthermore, during the bud stage and anthesis, the abundance of Actinobacteria, Proteobacteria, and their dominant species were influenced mainly by rhizosphere soil EC, ammonium nitrogen (-N), and nitrate nitrogen (-N), whereas, at maturity, soil pH and -N played a more significant role in shaping the community of ammonium-assimilating microorganisms. The MN treatment increased the root length density, surface area density, and root volume density of sunflower at the bud, flowering, and maturity stages compared to the CK. Moreover, root exudates such as oxalate and malate were positively correlated with the dominant species of Actinobacteria and Proteobacteria during anthesis and the maturation period. Under drip irrigation, applying 120 kg/hm2 of nitrogen to sunflowers effectively promoted the community structure of ammonium-assimilating microorganisms in rhizosphere soil and had a positive influence on the rhizosphere soil microenvironment and sunflower root growth.