The biological treatment of antibiotic-containing wastewater is a mainstream process, but the antibacterial activity from the persistence of antibiotics would inhibit the biological activity and function of wastewater treatment plants and lead to the risk of transmission of antibiotic resistant bacteria and genes. In this study, UV photolysis was selected as an appropriate pretreatment technology for antibiotic-containing wastewater. It could decompose many kinds of antibiotics and was not inhibited by the coexisting organics in wastewater. The antibacterial activities of five kinds of antibiotics, which were eliminated with UV irradiation, exhibited a significantly positive correlation with their parent compound concentrations. The photodecomposition of the main functional groups in antibiotics contributed to the elimination of antibacterial activity. Defluorination was the main pathway to eliminate the antibacterial activity of antibiotics containing a fluorine substituent (e.g., florfenicol and ofloxacin), while the photoinduced opening of the β-lactam ring was the most efficient route to eliminate the antibacterial activity of β-lactam antibiotics (e.g. cefalexin, amoxicillin and ampicillin). These results demonstrated that UV photolysis could be adopted as an efficient and promising pretreatment strategy for the source control of antibiotic antibacterial activity by the decomposition of antibiotic functional groups before the biological treatment unit.