A child who was born to two infidel parents and died before reaching the age of accountability, is he considered a Muslim in the eyes of Allah or not? Knowing that the Messenger of Allah, peace and blessings be upon him, said: Every newborn is born in a state of fitrah... Hadith. If he is a Muslim, are Muslims obligated to wash his body and pray over him?
If a non-accountable person dies between two disbelieving parents, their ruling in worldly matters is the same as their parents. They are not washed, prayed over, or buried in Muslim cemeteries. As for the Hereafter, their matter is left to Allah, the Exalted. It has been authentically reported from the Messenger of Allah (peace be upon him) that when he was asked about the children of polytheists, he said: “Allah knows best what they would have done.”
Some scholars have stated that Allah’s knowledge of them will be revealed on the Day of Resurrection, and they will be tested just as the people of the interval (those who lived in a time when no messenger was sent) and others like them will be tested. If they respond to what is required of them, they will enter Paradise, and if they disobey, they will enter Hell. Authentic hadiths from the Prophet (peace be upon him) confirm the testing of the people of the interval on the Day of Resurrection. These are those who did not receive the message of the messengers, and those in a similar situation, such as the children of polytheists, as Allah says: “And We never punish until We have sent a Messenger” [Al-Isra: 15]. This view is the most correct regarding the people of the interval and others who did not receive the divine message. It is the choice of Shaykh al-Islam Ibn Taymiyyah, his student Ibn al-Qayyim, and a group of the Salaf and Khalaf (may Allah have mercy on them all).
Ibn al-Qayyim (may Allah have mercy on him) elaborated on the ruling of the children of polytheists and the people of the interval at the end of his book “Tariq al-Hijratayn” under the title “The Categories of the Accountable.” Those who wish to refer to it will find it very beneficial.