This work quantitatively assessed the three-dimensional distribution of crystal lattice distortions in an epitaxial AlN thick film grown on a trench-patterned template, using nanobeam X-ray diffraction. Position-dependent ω-2θ-φ mapping clearly demonstrated local tilting, spacing and twisting of lattice planes as well as fluctuations in these phenomena on a sub-micrometer scale comparable to the pitch of the trench-and-terrace patterning. Analysis of the crystal lattice distortion in the depth direction was performed using a newly developed method in which the X-ray nanobeam diffracted from the sample surface to specific depths can be selectively detected by employing a Pt wire profiler. This technique generated depth-resolved ω-2θ-φ maps confirming that fluctuations in lattice plane tilting and spacing greatly depend on the dislocation distribution and the history of the AlN epitaxial growth on the trench-patterned structure. It was also found that both fluctuations were reduced on approaching the AlN surface and, in particular, were sharply reduced at specific depths in the terrace regions. These sharp reductions are attributed to the formation of sacrificial zones with degraded crystal quality around the trenches and possibly lead to raising the crystal quality near the surface of the AlN film.