α-Dicarbonyl compounds (α-DCs) are important intermediate products during the thermal processing of foods and are closely related to the development of chronic diseases in the human body. However, there remains a significant gap in the availability of rapid detection methods for α-DCs. So, the ratiometric molecularly imprinted polymers (RCDs@GCOFs@ MIPs) based on red-emitting biomass carbon dots (RCDs) and green-emitting fluorescent covalent organic frameworks (GCOFs) were constructed for the detection and removal of α-DCs in food processing. The ratiometric fluorescent sensors exhibited satisfactory detection and had good spiking recoveries in milk samples. And the excellent inhibition of pyrraline (PRL) by ratiometric fluorescent sensors was verified by simulating the milk pasteurization process. In addition, rapid onsite detection of α-DCs was achieved by recognizing the RGB value of the ratiometric fluorescence sensors via the smartphone. The ratiometric fluorescence sensors presented a new strategy for detecting and removing hazardous substances in food processing.