Considering the highly carcinogenic and mutagenic of anionic azo dyes to the environment and humans, the development of high efficiency adsorbent for them are of great significance. In this study, a novel hydroxyl-riched covalent organic framework (denoted as COF–OH), which can act as an advance adsorbent for anionic azo dyes, was fabricated for the first time. The as-prepared COF–OH demonstrated good dispersion in water, remarkable adsorption performances and good selectivity for anionic azo dyes including eriochrome black T, eriochrome blue black R and congo red. The adsorption capacities of them ranged from 90.71 to 229.12 mg g−1, and the extraction efficiencies of them (>75.91%) were much higher than other dyes (e.g. Methylene blue, direct red 80, 1.46%–39.57%). By optimizing the adsorption conditions (adsorbent dosage, adsorption time, pH, and salt concentration) and desorption conditions (desorption solvent, desorption time and desorption frequency), a dispersive micro solid-phase extraction (D-μ-SPE) method was developed. Further, coupled D-μ-SPE with HPLC-PDA analysis, an effective method was fabricated for the extraction and detection of three selected dyes. The method showed good linearity in the range of 0.1–200 μg mL−1 (R2 > 0.9966), low limits of quantification (0.10 μg mL−1-2.00 μg mL−1), low limits of detection (0.03–1.50 μg mL−1) and good precision. Finally, the COF–OH based D-μ-SPE was successfully applied to extract three selected dyes from water samples (recoveries ranged from 73.90 to 104.00%) and congo red from beverages (recoveries ranged from 81.40 to 111.80%). Besides, by using computer simulation, FT-IR and UV–vis analysis, the adsorption mechanisms of COF–OH to three selected dyes were explored preliminarily.