Even by the extremely distended definition of HRE as beggining with Ottonians, I don't see how it would be possible. The whole imperial kingship and the whole political reference to Rome (even it have been conflated by some emperors) is about the Roman pontiff, the protection given by the emperors and the ensuing working relationship (at least technically).
Even Frederic II Honestaufen, which was the closest thing of an atheist in Middle Ages you could find, never ever tought about dismissing the pope entierly.
Conversion being ruled out as extremely implausible, what about a Muslim conquest of Rome?
In spite of Arabo-Berber victories in Western Mediterranean basin, it doesn't looks much doable either : you did have regular raiding in Italy, including Latium, up to semi-permanant Arabic presence up to the Xth century (see Battle of Garigliano).
It's mostly that Arabo-Berbers weren't much interested about controlling the hinterland (as they didn't in Provence, while dominating the coast up to late Xth as well) by lack of manpower and political control (critically with this coastal presence being more or less largely autonomous).
On this perspective, it wasn't much different from most of Viking raids in Atlatic or Mediterranean : not a conquest but establishing some presence; while matters in Africa proper (critically being cut of most reinforcements) were a main focus, while Christian forces on the land weren't exactly underpowered (fleet and lands armies defeated some of these raids).
Assuming, tough, an actual takeover I think it may look like the IOTL Emirate of Bari that didn't had much time to live on before being repelled of southern Italy.
A temporary conquest of Rome is then doable, but in lack of much stable Arabo-Berber political entities with the ability to focus only on Mediterranean takeover, AND willing to go for the conquest of Latium that, is rich, was less obviously a target than, say, Sicily...
I'd say that in this case, either Carolingians/successors of Carolingians or Byzantines may take back relatively quickly the whole of it.
Even there, the consequences would be more important for Arabo-Berbers than for papacy :
It would be hardly the first time Rome get sacked : St Peter, the seat that technically represented pontifical legitimacy was sacked IOTL, and it wasn't considered as a divine punishment.
Even if the pope and all the cardinals were killed because Muslims would be ev0l, and admitting Arabs have an interest taking Rome once raided, the structures that made the pope an unifying and dominant religious structure IOTL would still be there.