Antibiotic residues pose a serious threat to ecosystems and food safety. Developing convenient, visual, and on-site detection methods is therefore in high demand and has a practical purpose. In this work, a near-infrared (NIR) fluorescent probe with an analysis platform based on a smartphone has been constructed for quantitative and on-site detection of metronidazole (MNZ). CdTe quantum dots with NIR emission at 710 nm (QD710) were prepared by using a simple hydrothermal method and showed good properties. A spectral overlap between absorption of MNZ and excitation of QD710 resulted in an effective inner filter effect (IFE) between QD710 and MNZ. Because of the IFE, the fluorescence of QD710 decreased gradually with increasing concentrations of MNZ. Based on the fluorescence response, quantitative detection and visualization of MNZ was achieved. NIR fluorescence analysis and the special IFE between probe and target can improve sensitivity and selectivity for MNZ. Additionally, these were also utilized for quantitative detection of MNZ in real food samples and the results were reliable and satisfactory. Meanwhile, a portable visual analysis platform in a smartphone was constructed for on-site analysis of MNZ, which can be used as an alternative method for detection of MNZ residues in situations with limited instrumental conditions. Therefore, this work provides a convenient, visual, and real-time analysis method for detection of MNZ and the analysis platform shows great potential for commercialization.