A man followed the Messenger of Allah ﷺ and said, "I want to follow you so I may share in the spoils with you."The Messenger of Allah ﷺ asked, "Do you believe in Allah and His Messenger?"He replied, "No."The Prophet ﷺ said, "Then we do not seek help from a polytheist."Then on the second occasion he asked him, "Do you believe in Allah and His Messenger?"He replied, "Yes."So the Prophet ﷺ went on, and the man followed him.
حدثنا أبو المنذر حدثنا مالك عن الفضيل بن أبي عبد الله عن عبد الله بن نيار الأسلمي عن عروة
أن رجلا اتبع رسول الله ﷺ فقال أتبعك لأصيب معك فقال رسول الله ﷺ تؤمن بالله ورسوله قال لا قال فإنا لا نستعين بمشرك قال فقال له في المرة الثانية تؤمن بالله ورسوله قال نعم فانطلق فتبعه
Its chain of transmission is sahih. Fudayl bin Abu Abdullah, the freedman of Mahri, is trustworthy, and his hadith appears in Muslim. The same applies to Abdullah bin Niyar Aslami.The hadith was reported by Muslim (3/1449, no. 1817) and Abu Dawud (3/75, no. 2732), both in the book of jihad, and by Tirmidhi (4/127, no. 1558) in the book of military expeditions, who said it is hasan gharib, and by Ibn Majah (2/945, no. 2832) and Darimi (2/300, no. 2497).