Abstract Dye‐selective nanofiltration membranes have great potential for chemical dye separation and purification as well as dye wastewater treatment. Two‐dimensional materials such as molybdenum disulfide (MoS 2 ) with excellent physical and chemical properties are ideal nanofiltration membrane materials. MoS 2 with few layers is used in combination with polyphenols to prepare highly selective filtration nanofiltration membranes for cationic dyes. The tannic acid (TA)‐MoS 2 composite material is constructed on the surface of a micro‐porous Mixed Cellulose Ester membrane by a vacuum filtration method, and the nanofiltration membrane exhibits good flexibility and excellent film‐forming properties. The maximum filtration efficiency of TAMoS 2 nanocomposite film for R6G can reach 80%, while for EY and MO, it is only 9.6% and 6.1% respectively. Filtration studies on mixtures of two different types of dyes show that the composite nanofiltration membrane has excellent separation performance. The separation characteristics and mechanism of the composite nanofilm on dyes are carefully studied, showing good selectivity for cationic dyes, which can be ascribed to the synergistic effect of non‐covalent interactions and steric hindrance. This work paves the way for the use of eco‐friendly membranes for water and wastewater treatment and provides an environmentally friendly solution for various applications.