Praise be to Allah.
Washing the deceased is a communal obligation (fard kifayah). If some of the community undertakes to do it, the obligation is waived from the others.
In order for washing of the deceased to be valid, it is not stipulated that the one who washes him should have reached puberty. Rather, if he is washed by someone who is below the age of puberty but is qualified to do that, this ghusl is valid.
It says in al-Mawsu‘ah al-Fiqhiyyah (13/60): The Hanafis and Hanbalis have clearly stated that it is permissible for a boy, if he is of sound mind, to wash the deceased, because his purification is valid if he purifies himself, so it is valid if he purifies someone else. This is what may be understood from the words of the Maliki and Shafa‘i scholars. End quote.
Shaykh Ibn ‘Uthaymin (may Allah have mercy on him) said: It is stipulated that the one who washes the deceased should be a Muslim, should have reached the age of discernment, and should be of sound mind."(Sharh al-Kafi 2/24).
And Allah knows best.