I do not believe, as a Catholic, the Holy Spirit chooses the Pope.
I believe, instead, the Holy Spirit protects the Church through the Pope. Which may include striking him down with a lightning bolt if need be. Or anathematizing him posthumously at an Ecumenical Council (which actually happened to Honorius).
That’s not what Church theology teaches. Of course the Pope is chosen by God according to the Church