In magnetic atomic gases, the dipolar relaxation process couples the system's spin and kinetic degrees of freedom, facilitating the conversion of kinetic energy into Zeeman energy. By utilizing optical pumping, atoms transferred to high spin states can be repumped to the ground state, thereby achieving a continuous cooling cycle and effectively lowering the system's temperature. As the energy removed in a single cooling cycle is much larger than the energy of scattered photons, this demagnetization cooling scheme significantly enhances cooling efficiency and reduces atomic loss. In this work, we establish state-coupled equations that incorporate dipolar relaxation and optical pumping to analyze the demagnetization cooling process, modeling the evolution of atom number and temperature during the cooling of
164Dy atoms. We develope a strategy to generate an optimal magnetic field waveform by maximizing the demagnetization rate. Base on this strategy, we investigate the influence of crucial experimental parameters on demagnetization cooling and determine their specific ranges for producing large atom number of BEC, including the optical dipole trap frequency, as well as the intensity and polarization purity of the optical pumping light. The results indicate that not only can demagnetization cooling achieve an efficiency of χ≈ 44.92, an order of magnitude higher than traditional evaporative cooling, but it also enables the direct preparation of a large number of dysprosium BEC within sub-second timescales, reducing the cooling time by an order of magnitude compared to conventional methods for dysprosium atoms.