Sunan an Nasai 852
The Book of Leading the Prayer (Al-Imamah)
أَخْبَرَنَا قُتَيْبَةُ، عَنْ مَالِكٍ، عَنْ هِشَامِ بْنِ عُرْوَةَ، عَنْ أَبِيهِ، أَنَّ عَبْدَ اللَّهِ بْنَ أَرْقَمَ، كَانَ يَؤُمُّ أَصْحَابَهُ فَحَضَرَتِ الصَّلاَةُ يَوْمًا فَذَهَبَ لِحَاجَتِهِ ثُمَّ رَجَعَ فَقَالَ سَمِعْتُ رَسُولَ اللَّهِ صلى الله عليه وسلم يَقُولُ " إِذَا وَجَدَ أَحَدُكُمُ الْغَائِطَ فَلْيَبْدَأْ بِهِ قَبْلَ الصَّلاَةِ " .
It was narrated from Hisham bin 'Urwah from his father that 'Abdullih bin Arqam used to lead his companions in prayer. The time for prayer came one day and he went to relieve himself then he came back and said:"I heard the Messenger of Allah (ﷺ) say: 'If any one of you feels the need to defecate, let him do that first, before he prays
Grading: Abu Ghuddah: Sahih · Al-Albani: Sahih · Zubair Ali Zai: Sahih
Text from the public-domain hadith-api dataset. Numbering follows that dataset and can differ by a few from some printed editions — check the wording, not only the number.