Ratiometric fluorescence detection is endowed with higher accuracy than single fluorescence signal assay. In this work, we construct a ratiometric fluorescence probe for the facile quantification of sulfadimethoxine (SDM) in foods. By wrapping N-doped carbon dots (N-CDs) and gold nanoclusters (AuNCs) into zeolitic imidazolate framework-8 (ZIF-8), the nanocomposite of N-CDs/AuNCs@ZIF-8 is facilely prepared and emits two fluorescence including 475nm from N-CDs and 650nm from AuNCs. Since bovine serum albumin (BSA) is the stabilizer of AuNCs, SDM can form a complex with BSA, resulting in the fluorescence quenching of AuNCs at 650nm by a static quenching mechanism. In contrast, SDM has a rare influence on the fluorescence of N-CDs (475nm). As a result, the use of the probe of N-CDs/AuNCs@ZIF-8 for SDM detection enables simultaneous measurement of response signal and reference signal. Under the optimal condition, the SDM assay based on the probe has a good linear relationship within 10 to 2 × 106ng/mL and the limit of detection (LOD) is low to 1.064ng/mL. In addition, the fluorescent probe shows good reliability for the detection of SDM in practical food samples.