Dissolved organic matter (DOM) has an important impact on the water treatment and reuse of petroleum refinery wastewater. In order to improve the treatment efficiency, it is necessary to understand the chemical composition of the DOM in the treatment processes. In this paper, the molecular composition of DOM in wastewater samples from a representative refinery were characterized. The transformation of various compounds along the wastewater treatment processes was investigated. A total of 61 heteroatomic class species were detected from the DOM extracts, in which CHO (molecules composed of carbon, hydrogen, and oxygen atoms) and CHOS (CHO molecules that also contained sulfur) class species were the most abundant and account for 78.43% in relative mass peak abundance. The solid phase extraction DOM from the dichloromethane unextractable fraction exhibited a more complex molecular composition and contained more oxygen atoms than in the dichloromethane extract. During wastewater treatment processes, the chemical oxygen demand (COD) and ammonia-nitrogen were reduced by more than 90%. Volatile organic compounds (VOCs) accounted for about 30% of the total COD, in which benzene and toluene were dominant. After biochemical treatment, the VOCs were effectively removed but the molecular diversity of the DOM was increased and new compounds were generated. Sulfur-containing class species were more recalcitrant to biodegradation, so the origin and transformation of these compounds should be the subject of further research.