Pathogenic bacterial fouling in agriculture and food-associated products poses mounting food safety concerns today. Efficient integration of precise tracking and on-demand bacterial killing to achieve the source control of pathogenic bacteria at the single-cell level is one of the most valuable antifouling methods for safeguarding food safety but remains unexplored. Here, we report an all-in-one design strategy as a proof of concept to establish a stimuli-responsive nanoprobe PDANSs-FAM-Apt for the detection of Staphylococcus aureus (S. aureus) at the single-cell level, which could be capable of guiding the on-demand photothermal killing of bacteria upon near-infrared (NIR) light irradiation. By examining the size-dependent modulation of the fluorescence resonance energy transfer efficiency to polydopamine nanospheres (PDANSs), PDANSs-FAM-Apt was finally assembled by 6-carboxyfluorescein-terminated S. aureus, binding the aptamer (FAM-Apt) and PDANSs at ∼258 nm through π-π stacking interactions. As a result, PDANSs-FAM-Apt exhibits a remarkable fluorescence enhancement (∼261-fold) to S. aureus with a satisfactory detection limit of 1.0 cfu/mL, allowing for assay at the single-cell level and thus ultralow background fluorescence imaging of S. aureus as well as its biofilms. Moreover, PDANSs-FAM-Apt shows a high photothermal bactericidal property upon NIR light irradiation, endowing it with the strong capacity to efficiently produce heat for destroying S. aureus and its biofilms with the guidance of imaging results. This work emphasizes the versatility of using the combination of stimuli-responsive fluorescence imaging dependent on the PDANS size modulation and NIR light-activated photothermal antibacterial activity to design stimuli-responsive nanoprobes with an improved precision for pathogenic bacteria monitoring and source controlling, which opens a promising antifouling avenue to eliminate bacteria and disrupt bacterial biofilms in agriculture and food-related industries.