No, the selection of a pope is not an exercise of the Church’s infallibility. It is an expression of the elective cardinals’ prudential judgment. We know that the Holy Spirit provides the cardinals with the graces necessary to assist their prudential judgment, but he is not directly responsible for their choice. As then-Cardinal Joseph Ratzinger once said in an interview in response to a question of whether the Holy Spirit is responsible for the pope who is elected:
I would not say so, in the sense that the Holy Spirit picks out the pope. … I would say that the Spirit does not exactly take control of the affair, but rather like a good educator, as it were, leaves us much space, much freedom, without entirely abandoning us. Thus the Spirit’s role should be understood in a much more elastic sense, not that he dictates the candidate for whom one must vote. Probably the only assurance he offers is that the thing cannot be totally ruined.
If the man chosen were not a sound choice, the Holy Spirit would also, through the gift of papal infallibility, protect the Church from such a pope infallibly defining an error in the realms of doctrine or morals.