The DArk Matter Particle Explorer (DAMPE) can measure $gamma$-rays in the energy range from a few GeV to about 10 TeV. The direction of each $gamma$-ray is reconstructed with respect to the reference system of the DAMPE payload. In this paper, we adopt a maximum likelihood method and use the $gamma$-ray data centered around several bright point-like sources to measure and correct the angular deviation from the real celestial coordinate system, the so called ``boresight alignment of the DAMPE payload. As a check, we also estimate the boresight alignment for some sets of simulation data with artificial orientation and obtain consistent results. The time-dependent boresight alignment analysis does not show evidence for significant variation of the parameters.