Among the supplications of the Prophet ﷺ on the day of Hunayn was, "O Allah, if You will, You shall not be worshipped after this day."
كان من دعاء النبي ﷺ يوم حنين: اللهم إنك إن تشأ لا تعبد بعد اليوم.
Ahmad (12220) and Ibn Abu Shayba (30200) and (38140) narrated it, both from Yazid bin Harun, who said, Humayd told us, from Anas, who said, then he mentioned it. This wording is that of Ibn Abu Shayba. Its chain is sahih.The more well known account is that this supplication took place at Badr and Uhud, but that does not preclude it being repeated at Hunayn as well, since if the Muslims had been defeated on the day of Hunayn, the Arabs would have apostatized, just as some of them apostatized during the time of Abu Bakr Siddiq.