Periphyton is considered important for removal of organic pollutants from water bodies, but knowledge of the impacts of antibiotics on the community structure and ecological function of waterbodies remains limited. In this study, the effects of oxytetracycline hydrochloride (OTC) on the communities of photoautotrophic epilithon and epipelon and its effect on nitrogen and phosphorus concentrations in the water column were studied in a 12-day mesocosm experiment. The dynamics of nitrogen and phosphorus concentrations in the epipelon and epilithon experiment showed similar patterns. The concentrations of total nitrogen, dissolved total nitrogen, ammonium nitrogen, total phosphorus and dissolved total phosphorus in the water column increased rapidly during the initial days of exposure, after which a downward trend occurred. In the epilithon experiment, we found that the photosynthesis (Fv/Fm) and biomass of epilithon were significantly (P < 0.05) stimulated in the low concentration group. Contrarily, growth and photosynthesis (Fv/Fm) were significantly (P < 0.05) reduced in the medium and high concentration group. We further found that the photosynthetic efficiency of photoautotrophic epilithon was negatively correlated with the concentrations of nitrogen and phosphorus in the water column (P < 0.05). Principal coordinate analysis (PCoA) showed that the communities of epilithic algae in the control group and in the low concentration group were significantly (P < 0.05) different from that of the high concentration group during the initial 4 days. After 8 days' exposure, all groups tended to be similar, indicating that epilithon showed rapid adaptability and/or resilience. Similar results were found for the relative abundance of some epilithic algae. Our findings indicate that the biofilm system has strong tolerance and adaptability to OTC as it recovered fast after an initial suppression, thus showing the important role of periphyton in maintaining the dynamic balance of nutrients with other processes in aquatic ecosystems.