Hadithcore
Musnad Ahmad 3624
graded· 3208

It was narrated that ‘Abdullah (رضي الله عنه) said:

The Messenger of Allah (ﷺ), who is the most truthful one, told us: “The creation of any one of you is put together in his mother's womb for forty days, then he becomes a ‘alaqah (a piece of thick coagulated blood) for a similar period, then he becomes like a chewed piece of flesh (mudghah) for a similar period, then Allah sends to him an angel who breathes the soul into him and is enjoined to write down four things: his provision, his lifespan, his deeds and whether He is doomed (to Hell) or blessed (destined for Paradise). By the One besides Whom there is no other god, one of you may do the deeds of the people of Paradise until there is nothing between him and it but a cubit, then the decree overtakes him and he does a deed of the people of Hell and enters it. And one of you may do the deeds of the people of Hell until there is nothing between him and it but a cubit, then the decree overtakes him and he does a deed of the people of Paradise, and enters it."

References1 variant
Arabic/English book
Book 26, Hadith 3624