At the highest point of its trajectory, the ball has primarily potential energy. At this point, the ball's velocity is zero, so it has no kinetic energy. However, due to its height above the ground, the ball has gravitational potential energy, which is the energy stored in an object due to its position in a gravitational field.
When the spring was compressed and released, it converted the spring's potential energy into kinetic energy, launching the ball into the air. As the ball traveled upward, its kinetic energy was converted into potential energy due to gravity. At the highest point of its trajectory, all of the ball's kinetic energy has been converted into potential energy, and it momentarily stops moving before beginning to fall back towards the ground.
Therefore, at the highest point of its trajectory, the ball's mechanical energy is primarily in the form of potential energy, specifically gravitational potential energy.