I heard the Messenger of Allah ﷺ, the truthful and trusted, say, "The creation of each one of you is gathered in his mother's womb for forty nights, then it becomes a clinging clot for a similar period, then a lump of flesh for a similar period. Then Allah sends an angel to him who is commanded to write down his deeds, his lifespan, his provision, and whether he will be wretched or blessed."Then he said, "By the One in whose hand is the soul of Abdullah, a man may perform the deeds of the people of Paradise until there is only a forearm's length between him and Paradise, then what was written overtakes him and he performs the deeds of the people of the Fire, so he dies and enters the Fire."Then he said, "By the One in whose hand is the soul of Abdullah, a man may perform the deeds of the people of the Fire until there is only a forearm's length between him and the Fire, then what was written overtakes him and he performs the deeds of the people of Paradise, so he dies and enters Paradise."
حدثنا حسين بن محمد حدثنا فطر عن سلمة بن كهيل عن زيد بن وهب الجهني
سمعت رسول الله ﷺ يقول وهو الصادق المصدوق يجمع خلق أحدكم في بطن أمه أربعين ليلة ثم يكون علقة مثل ذلك ثم يكون مضغة مثل ذلك ثم يبعث الله عز وجل إليه ملكا من الملائكة فيقول اكتب عمله وأجله ورزقه واكتبه شقيا أو سعيدا ثم قال والذي نفس عبد الله بيده إن الرجل ليعمل بعمل أهل الجنة حتى ما يكون بينه وبين الجنة غير ذراع ثم يدركه الشقاء فيعمل بعمل أهل النار فيموت فيدخل النار ثم قال والذي نفس عبد الله بيده إن الرجل ليعمل بعمل أهل النار حتى ما يكون بينه وبين النار غير ذراع ثم تدركه السعادة فيعمل بعمل أهل الجنة فيموت فيدخل الجنة
Its isnad is sahih. Fitr is Ibn Khalifa. The hadith is a repetition of 3624, but there it is entirely marfu, while here the last part of it is made to be from the speech of Ibn Masud. The raising of the hadith to the Prophet is an addition from a trustworthy narrator, and it is therefore accepted.