Long-wavelength fluorescent carbon quantum dots, as an emerging nanomaterial, could effectively overcome the problems of low detection efficiency, strong antibacterial resistance, and severe imaging interference of traditional methods in the diagnosis and therapy of bacterial infections. Herein, an innovative design of nitrogen and boron codoped orange fluorescent carbon quantum dots (NB-CDs) with both bacterial recognition and binding, long-wavelength fluorescence fast imaging, and broad-spectrum antimicrobial function was developed. The diagnostic and therapeutic integrated nanoplatform was successfully constructed by the solvothermal method using citric acid (CA) as the carbon source, safranine T (ST) as the nitrogen dopant, and 3-aminobenzeneboronic acid (M-APBA) as the boron source. The carbon quantum dots possessed orange fluorescence emission (λEm = 581 nm) and high quantum yield (QY) (41.50%), which could effectively avoid the interference of tissue spontaneous short-wavelength fluorescence. The boronic acid group on the surface of the carbon quantum dots is beneficial for covalent binding to bacteria, achieving a synergistic function of antimicrobial and imaging. Meanwhile, the carbon quantum dots exhibited significant antibacterial activity against both Escherichia coli (E. coli) and Staphylococcus aureus (S. aureus) (bactericidal rate > 99%), with the minimum bactericidal concentrations (MBC) being 6.90 and 6.13 mg/mL, respectively, and enabled rapid fluorescence labeling imaging of bacteria within 1 h. In this study, an integrated diagnostic and therapeutic system was constructed by combining the binding ability of boric acid groups to bacteria with the optical properties of long-wavelength orange fluorescent carbon quantum dots, providing a new avenue for the development of smart antibacterial materials.