One of the central difficulties in the quantization of the gravitational interactions is that they are described by a set of constraints. The standard strategy for dealing with the problem is the Dirac quantization procedure, which leads to the Wheeler-DeWitt equation. However, solutions to the equation are known only for specific symmetry-reduced systems, including models of quantum cosmology. Novel methods, which enable solving the equation for complex gravitational configurations, are therefore worth seeking. Here, we propose and investigate a new method of solving the Wheeler-DeWitt equation for minisuperspace models (with a finite number of classical degrees of freedom). The approach employs variational quantum algorithms and is possible to implement on quantum computers. For this purpose, the gravitational system is regularized, by performing spherical compactification of the phase space. This makes the system's Hilbert space finite dimensional and allows to use $SU(2)$ variables, which are easy to handle in quantum computing. The validity of the method is examined in the case of the flat de Sitter universe. Both an emulator of a quantum computer and the IBM superconducting quantum computer have been used. The advantages and limitations of the approach are discussed.