Recently, pharmaceuticals and personal care products in the water environment exhibited potential risks to both human and aquatic organisms. In order to improve the sensitivity and accuracy of pharmaceutical detection, the polyimidazolyl acetate ionic liquid was synthesized by Radziszewski reaction and coated on cellulose filter papers as a thin‐film extraction phase for extraction of non‐steroidal anti‐inflammatory drugs from water. The attenuated total reflection‐infrared spectrometry, thermogravimetric analysis, and scanning electron microscope analyses demonstrated that the polyimidazolyl acetate ionic liquid was successfully prepared and attached to the surface of the cellulose filter paper through chemical bonding. The adsorption capacity of the homemade thin‐film extraction material for the four non‐steroidal anti‐inflammatory drugs was greater than 8898 ng/cm2 under the optimum conditions, and the desorption rate was over 90%. Then, a paper‐based thin‐film extraction phase‐high‐performance liquid chromatography‐tandem mass spectrometry method was established for the extraction of non‐steroidal anti‐inflammatory drugs in water. This method provided limits of detection and limits of quantification were in the range of 0.02–0.15 and 0.17–0.50 μg/L, respectively. Hence, the obtained thin‐film extraction phase showed excellent recovery and reproducibility for the target non‐steroidal anti‐inflammatory drugs with carboxyl groups from water.