The classical Dirichlet boundary value problem for the polyharmonic equation in the unit ball is considered. For this problem with polynomial right-hand side and zero boundary data a polynomial solution is constructed. Our approach is based on the Almansi representation of polyharmonic functions and on the previously obtained an explicit representation of the harmonic components, expressed through the given polyharmonic function. In the case of the harmonic equation the known representation of the solution through the Green function is obtained.