the whole world and everything in it had been yours, would you have ransomed yourself with it?” He will answer, “Yes.” Allah will then say, “You have lied! I asked of you something far easier than that while you were still in the loins—(in another wording: the back)—of Adam: that you not commit associationism with Me, and I would not admit you into the Fire; yet you insisted on associationism.” He will then be ordered to the Fire.
This ḥadīth was recorded by al-Bukhārī (2/333; 4/239, 242), Muslim (8/134–135), Aḥmad (3/127, 129), and likewise by Abū ʿAwānah and Ibn Ḥibbān in their Ṣaḥīḥ collections, as cited in al-Jāmiʿ al-Kabīr (3/95/1), through the chain of Abū ʿImrān al-Jawnī—the wording being that of Muslim—and Qatādah, both transmitting from Anas, from the Prophet ﷺ.
It also has a third route: from Thābit, from Anas, with similar wording.
Ibn Ḥajar in Fatḥ (6/349) attributed it to Muslim and al-Nasāʾī; I have not found it in Muslim, and as for al-Nasāʾī it appears he meant his al-Sunan al-Kubrā—Allah knows best.
Regarding the phrase, “He will say: ‘You have lied,’” al-Nawawī commented:
“It means that were he returned to the world he would not ransom himself, for he had once been asked for something far easier and refused. Thus it matches the Almighty’s words: ‘And if they were returned, they would revert to what they were forbidden; indeed, they are liars’ (Q 6:28). By this…”