A backward differentiation formula (BDF) has been shown to be an effective way to solve a system of ordinary differential equations (ODEs) that have some degree of stiffness. However, sometimes, due to high-frequency variations in the external time series of boundary conditions, a small time-step is required to solve the ODE system throughout the entire simulation period, which can lead to a high computational cost, slower response, and need for more memory resources. One possible strategy to overcome this problem is to dynamically adjust the time-step with respect to the system's stiffness. Therefore, small time-steps can be applied when needed, and larger time-steps can be used when allowable. This paper presents a new algorithm for adjusting the dynamic time-step based on a BDF discretization method. The parameters used to dynamically adjust the size of the time-step can be optimally specified to result in a minimum computation time and reasonable accuracy for a particular case of ODEs. The proposed algorithm was applied to solve the system of ODEs obtained from an activated sludge model (ASM) for biological wastewater treatment processes. The algorithm was tested for various solver parameters, and the optimum set of three adjustable parameters that represented minimum computation time was identified. In addition, the accuracy of the algorithm was evaluated for various sets of solver parameters.