Sugarcane is an important sugar and energy crop worldwide, requiring a large amount of nitrogen (N). However, excessive application of synthetic N fertilizer causes environmental pollution in farmland. Endophytic nitrogen-fixing bacteria (ENFB) provide N nutrition for plants through biological N fixation, thus reducing the need for chemical fertilizers. The present study investigated the effect of the N-fixing endophytic strain Enterobacter roggenkampii ED5 on phytohormone indole-3-acetic acid (IAA), N-metabolism enzyme activities, microbial community compositions, and N cycle genes in sugarcane rhizosphere soil at different N levels. Three levels of 15N-urea, such as low N (0 kg/ha), medium N (150 kg/ha), and high N (300 kg/ha), were applied. The results showed that, after inoculating strain ED5, the IAA content in sugarcane leaves was significantly increased by 68.82% under low N condition at the seedling stage (60 days). The nitrate reductase (NR) activity showed a downward trend. However, the glutamine synthase (GS) and NADH-glutamate dehydrogenase (NADH-GDH) activities were significantly enhanced compared to the control under the high N condition, and the GS and NR genes had the highest expression at 180 and 120 days, respectively, at the low N level. The total N content in the roots, stems, and leaves of sugarcane was higher than the control. The 15N atom % excess of sugarcane decreased significantly under medium N condition, indicating that the medium N level was conducive to N fixation in strain ED5. Metagenome analysis of sugarcane rhizosphere soil exhibited that the abundance of N-metabolizing microbial richness was increased under low and high N conditions after inoculation of strain ED5 at the genus level, while it was increased at the phylum level only under the low N condition. The LefSe (LDA > 2, p < 0.05) found that the N-metabolism-related differential microorganisms under the high N condition were higher than those under medium and low N conditions. It was also shown that the abundance of nifDHK genes was significantly increased after inoculation of ED5 at the medium N level, and other N cycle genes had high abundance at the high N level after inoculation of strain ED5. The results of this study provided a scientific reference for N fertilization in actual sugarcane production.