Language:
كتاب القدر
82  
Divine Will (Al-Qadar)
(3)
Chapter: It is Allah Who knows what they would have done
(3)
باب اللَّهُ أَعْلَمُ بِمَا كَانُوا عَامِلِينَ
Sahih al-Bukhari 6599, 6600

Narrated Abu Huraira:

Allah's Messenger (ﷺ) said, "No child is born but has the Islamic Faith, but its parents turn it into a Jew or a Christian. It is as you help the animals give birth. Do you find among their offspring a mutilated one before you mutilate them yourself?" The people said, "O Allah's Messenger (ﷺ)! What do you think about those (of them) who die young?" The Prophet (ﷺ) said, "Allah knows what they would have done (were they to live)."

حَدَّثَنِي إِسْحَاقُ، أَخْبَرَنَا عَبْدُ الرَّزَّاقِ، أَخْبَرَنَا مَعْمَرٌ، عَنْ هَمَّامٍ، عَنْ أَبِي هُرَيْرَةَ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏ "‏ مَا مِنْ مَوْلُودٍ إِلاَّ يُولَدُ عَلَى الْفِطْرَةِ، فَأَبَوَاهُ يُهَوِّدَانِهِ وَيُنَصِّرَانِهِ، كَمَا تُنْتِجُونَ الْبَهِيمَةَ، هَلْ تَجِدُونَ فِيهَا مِنْ جَدْعَاءَ حَتَّى تَكُونُوا أَنْتُمْ تَجْدَعُونَهَا ‏"‏‏.‏ قَالُوا يَا رَسُولَ اللَّهِ أَفَرَأَيْتَ مَنْ يَمُوتُ وَهْوَ صَغِيرٌ قَالَ ‏{‏اللَّهُ أَعْلَمُ بِمَا كَانُوا عَامِلِينَ‏}‏
Reference : Sahih al-Bukhari 6599, 6600
In-book reference : Book 82, Hadith 6
USC-MSA web (English) reference : Vol. 8, Book 77, Hadith 597
  (deprecated numbering scheme)