Here, ribavirin (RBV) was introduced into metal organic frameworks (MOFs) in this instance to direct the in situ fabrication of appropriate nanocage structures to facilitate the targeted binding of RBV. Well-designed nano-caged RBV imprinted membranes (NCRIMs) have remarkable antifouling capabilities and can selectively separate RBV from wastewater generated by the RBV production process by constructing imprinting sites inside the molecule. Polydopamine (PDA) is rich in hydrophilic groups (hydroxyl and amino groups) that interact with water molecules via hydrogen bonding, thereby generating a hydrate layer on the membrane surface. The synthesized RBV imprinted sites were homogeneously scattered at the interface and inside of the membrane, resulting in a satisfactory selectivity. Notably, methacrylic acid and acrylamide act as functional monomers that synergistically promote the ability to selectively recognise RBV imprinting sites. It was demonstrated that NCRIMs had favourable rebinding selectivity (αRBV/ACV = 3.28, αRBV/AZT = 2.48, αRBV/LAM = 3.72) as well as partial selectivity (βRBV /LAM = 9.48, βRBV/AZT = 8.20, βRBV/ACV = 2.95), indicating the potential of NCRIMs in practical application. What is significant is that the cooperative imprinting and modification methods devised in this study offer directions for the selective isolation of valuable components from complex environments, as well as a reference towards the design of potentially highly resistant membranes.