Abdullah bin Abbas reported,

There was a time when I used to say that the children of the Muslims would be with the Muslims and the children of the polytheists would be with the polytheists, until so-and-so reported to me from so-and-so that the Messenger of Allah ﷺ was asked about them and replied, "Allah knows best what they would have done."He said, "I then met the man, and he confirmed it to me, so I stopped saying what I had been saying."

Azami 1085

Sahih

عن ابن عباس، قال

أتى علي زمان، وأنا أقول: أولاد المسلمين مع المسلمين، وأولاد المشركين مع المشركين، حتى حدثني فلان، عن فلان، أن رسول الله ﷺ سئل عنهم فقال: الله أعلم بما كانوا عاملين. قال: فلقيت الرجل، فأخبرني فأمسكت عن قولي.

الأعظمي 1085صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Faith
Chapter
Belief in the divine decree and predestination
Section
Prophet ﷺ was asked about the offspring of the polytheists in the Hereafter and he said, "Allah knows best what they would have done"
Numbering
Jami al-Kamil 1085 (2nd edition)
Azami 1085