What pope, exactly, said that the earth is not flat?
The entire Galileo debate was over whether the Earth orbited the Sun or the Sun orbited the Earth. "Orbiting" isn't a concept in a Flat Earth model, and Galileo's heliocentric model was never criticised for its representation of the Earth as a sphere, nor was such even commented on(because it was unremarkable, it was what the geocentrists believed too).
Every time the pope crowned a Holy Roman Emperor, the Emperor held a
globus cruciger(a ball with a cross on top) representing Christ's reign over the Earth. So the Earth was represented as a globe for a millennium at these coronations and never once did a pope criticise this representation, because the popes too(as did all men in those times) believed in a round Earth.
The Flat Earth had some support in the Patristic Era, but it had no adherence at all in the medieval era or after.