Abu Hurairah (May Allah be pleased with him) said:
I heard the Messenger of Allah (ﷺ) saying, "The first to be judged on the Day of Resurrection will be a man who had died as a martyr. He will be brought forward. Allah will remind him of the favours He had bestowed upon him and the man will acknowledge them. Then He will ask him: 'What did you do to express gratitude for it?' The man will reply: 'I fought for Your Cause till I was martyred.' Allah will say: 'You have lied. You fought so that people might call you courageous; and they have done so.' Command will then be issued about him and he will be dragged on his face and thrown into Hell. Next a man who had acquired and imparted knowledge and read the Qur'an will be brought forward, Allah will remind him of the favours He had bestowed upon him and the man will acknowledge them. Then He will ask him: 'What did you do to express gratitude for it?' The man will reply: 'I acquired knowledge and taught it, and read the Qur'an for Your sake.' Allah will say to him: 'You have lied. You acquired knowledge so that people might call you a learned (man), and you read the Qur'an so that they might call you a reciter, and they have done so.' Command will then be issued about him, and he will be dragged on his face and thrown into Hell. Next a man whom Allah had made affluent and to whom Allah had given plenty of wealth, will be brought forward, Allah will remind him of the favours He had bestowed upon him and the man will acknowledge them. He will ask him: 'What did you do to express gratitude for it?' The man will reply: 'I did not neglect any of the ways You liked wealth to be spent liberally for Your sake'. Allah will say to him: 'You have lied. You did it so that people might call you generous, and they have done so.' Command will then be issued about him and he will be dragged on his face and thrown into Hell."[Muslim].
App reference: Book 18, Hadith 107
Arabic/English book reference: Book 18, Hadith 1617