A dual-recognition carbon dot-based nanoprobe with controllable G-quadruplex release is developed for ratiometric fluorescence detection of pathogenic bacteria in a fast and precise way, which opens a promising avenue for efficient detection and early warning of pathogenic bacteria in food matrices.