Macrolide antibiotics, including erythromycin, clarithromycin, and azithromycin, are often mistakenly used for human treatment worldwide. Therefore, according to the 2018/840/EU regulation, they are considered high-risk substances on the EU wide monitoring and observation list. The current work investigates the adsorption behavior of drug pollutants on the covalent organic framework (COF) of 1,3,5-tris (4-aminophenyl) benzene/2,5-dimethoxybenzaldehyde (TAPB-DMTP). In this study, we employed molecular dynamics simulations and mild metadynamics to evaluate the adsorption affinity of the original covalent organic framework and its functionalized form (F-COF) for the removal of four different drug pollutant molecules (PPM): erythromycin (EMC), dexamethasone (DEG), azithromycin (AZM), and clarithromycin (CMC). We used MD simulation to investigate the effects of two different temperatures (298 and 310 K) on enhancing the adsorption of drug pollutants in wastewater by COF/F-COF. To evaluate this process, several descriptors were calculated based on simulated trajectories, including interaction energy, root mean square deviation, radial distribution function, solvent accessible surface area, mean square displacement, and hydrogen bond (HB) number. It has been determined that the interaction between HB and X-H ·π (X=C, N, O; π=aromatic system) is the most critical factor affecting the stability of the system. In addition, studies have shown that COFs with pore based structures have higher pollutant removal capabilities.