The preparation process of Mg,N-CDs/Eu-MOFs@MIP and the process of ratiometric fluorescence sensing and smartphone-based visual assay of trace oxytetracycline in real samples. • A novel core–shell ratiometric fluorescence biomimetic sensor was constructed. • Imprinting sites endowed Mg,N-CDs/Eu-MOFs@MIP with desirable specificity. • The efficient dual-channel strategy significantly enhanced the sensitivity. • Smartphone-assisted device provided a new strategy for onsite analysis of OTC. • The platform achieved ultrasensitive and visual smart monitoring of OTC in samples. Exploring high-performance fluorescence strategies for onsite monitoring of oxytetracycline (OTC) is of great significance for protecting human health. Herein, an innovative ratiometric fluorescence biomimetic sensor featured with high sensitivity and selectivity was constructed based on magnesium and nitrogen co-doped carbon dots embedded europium metal–organic framework and incorporating molecularly imprinted polymer (Mg,N-CDs/Eu-MOFs@MIP). In this protocol, MIP layer functioning as recognition units endowed Mg,N-CDs/Eu-MOFs@MIP with satisfactory binding efficiency and anti-interference ability. Mg,N-CDs/Eu-MOFs as both supporter and signal tag enabled the sensor to not only demonstrate a fast fluorescence response, but also yield reverse response signals depending on the synergistic effect of inner filter effect (IFE) and antenna effect (AE), achieving signal amplification. Benefiting from the efficient dual-channel strategy, Mg,N-CDs/Eu-MOFs@MIP exhibited a wide linear range (0.02–50 μg mL −1 ) with a sensitive detection limit (6.6 ng mL −1 ) and a marked color transformation (blue-to-red), which was highly desirable for monitoring of oxytetracycline. Simultaneously, aiming at attaining precise onsite analysis, a portable intelligent sensing platform was devised by integrating Mg,N-CDs/Eu-MOFs@MIP and a smartphone-assisted device. The smartphone with an installed color recognizer application as signal reader and analyzer realized oxytetracycline visual sensing by capturing and digitizing fluorescence images. More significantly, the portable platform was successfully applied to the onsite monitoring of OTC in water samples and milk samples with acceptable results. Accordingly, the as-developed platform demonstrated low-cost, portability, easy implementation, desirable specificity and sensitivity, presenting great potential for point-of-care testing.