Anas bin Malik reported,

The Prophet of Allah ﷺ entered a date-palm grove belonging to Banu Najjar and heard a sound that startled him.He asked, "Who are the occupants of these graves?"They replied, "Messenger of Allah, they are people who died during the time of ignorance."He said, "Seek refuge with Allah from the punishment of the Fire and from the trial of the Dajjal."They asked, "Why is that, Messenger of Allah?"He said, "When a believer is placed in his grave, an angel comes to him and asks, 'What did you used to worship?' If Allah has guided him, he answers, 'I used to worship Allah.' Then he is asked, 'What did you used to say about this man?' He answers, 'He is the servant of Allah and His Messenger.' He is not questioned about anything else. He is then taken to a house that had been prepared for him in the Fire, and it is said to him, 'This was your house in the Fire, but Allah protected you and had mercy on you, so He exchanged it for a house in Paradise.' He says, 'Let me go and give the good news to my family.' He is told, 'Remain where you are.'As for the disbeliever, when he is placed in his grave, an angel comes to him and rebukes him, asking, 'What did you used to worship?' He replies, 'I do not know.' He is told, 'You did not know and you did not follow those who knew.' Then he is asked, 'What did you used to say about this man?' He replies, 'I used to say what people said.' The angel then strikes him with an iron hammer between his ears, and he lets out a scream heard by all creatures except humans and jinn."

Abu Dawud 4751

Sahih

حدثنا محمد بن سليمان الأنباري حدثنا عبد الوهاب بن عطاء الخفاف أبو نصر عن سعيد عن قتادة

عن أنس بن مالك قال

إن نبي الله ﷺ دخل نخلا لبني النجار فسمع صوتا ففزع فقال من أصحاب هذه القبور قالوا يا رسول الله ناس ماتوا في الجاهلية فقال تعوذوا بالله من عذاب النار ومن فتنة الدجال قالوا ومم ذاك يا رسول الله قال إن المؤمن إذا وضع في قبره أتاه ملك فيقول له ما كنت تعبد فإن الله هداه قال كنت أعبد الله فيقال له ما كنت تقول في هذا الرجل فيقول هو عبد الله ورسوله فما يسأل عن شيء غيرها فينطلق به إلى بيت كان له في النار فيقال له هذا بيتك كان لك في النار ولكن الله عصمك ورحمك فأبدلك به بيتا في الجنة فيقول دعوني حتى أذهب فأبشر أهلي فيقال له اسكن وإن الكافر إذا وضع في قبره أتاه ملك فينتهره فيقول له ما كنت تعبد فيقول لا أدري فيقال له لا دريت ولا تليت فيقال له فما كنت تقول في هذا الرجل فيقول كنت أقول ما يقول الناس فيضربه بمطراق من حديد بين أذنيه فيصيح صيحة يسمعها الخلق غير الثقلين

أبو داود 4751صحيح
Contents
Reference
Commentary
Ayat
Collection
Sunan Abu Dawud
Book
Sunnah
Chapter
Questioning in the grave and punishment of the grave
Numbering
Darussalam 4751
Abu Dawud 4751