Although the septic tank is the most applied on-site system for wastewater pre-treatment, limited research has been performed to determine sludge accumulation and biogas production in the tank. Therefore a dynamic mathematical model based on the Anaerobic Digestion Model No. 1 (ADM1) was developed for anaerobic digestion of the accumulated sludge in a septic tank treating domestic wastewater or black water. The results showed that influent chemical oxygen demand (COD) concentration and hydraulic retention time (HRT) of the tank mainly control the filling time with sludge, while operational temperature governs characteristics of the accumulated sludge and conversion to methane. For obtaining stable sludge and high conversion, the tank needs to be operated for a period more than a year without sludge wasting. Maximum conversion to methane in the tank is about 50 and 60% for domestic wastewater and black water, respectively. The required period for sludge wasting depends on the influent COD concentration and the HRT, while characteristics of the wasted sludge are affected by operational temperature followed by the influent COD concentration and the HRT. Sludge production from the tank ranges between 0.19 to 0.22 and 0.13 to 0.15 L/(person.d), for the domestic wastewater and black water, respectively.