Mishkat al-Masabih 81
عَنْ أَبِي هُرَيْرَةَ قَالَ قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «احْتَجَّ آدَمُ وَمُوسَى عَلَيْهِمَا السَّلَام عِنْدَ رَبِّهِمَا فَحَجَّ آدَمُ مُوسَى قَالَ مُوسَى أَنْتَ آدَمُ الَّذِي خَلَقَكَ اللَّهُ بِيَدِهِ وَنَفَخَ فِيكَ مِنْ رُوحِهِ وَأَسْجَدَ لَكَ مَلَائِكَتَهُ وَأَسْكَنَكَ فِي جَنَّتِهِ ثُمَّ أَهَبَطْتَ النَّاسَ بِخَطِيئَتِكَ إِلَى الأَرْض فَقَالَ آدَمُ أَنْتَ مُوسَى الَّذِي اصْطَفَاكَ اللَّهُ بِرِسَالَتِهِ وَبِكَلَامِهِ وَأَعْطَاكَ الْأَلْوَاحَ فِيهَا تِبْيَانُ كُلِّ شَيْءٍ وَقَرَّبَكَ نَجِيًّا فَبِكَمْ وَجَدَتِ اللَّهِ كَتَبَ التَّوْرَاةَ قَبْلَ أَنْ أُخْلَقَ قَالَ مُوسَى بِأَرْبَعِينَ عَامًا قَالَ آدَمُ فَهَلْ وَجَدْتَ فِيهَا (وَعَصَى آدَمُ ربه فغوى) قَالَ نَعَمْ قَالَ أَفَتَلُومُنِي عَلَى أَنْ عَمِلْتُ عَمَلًا كَتَبَهُ اللَّهُ عَلَيَّ أَنْ أَعْمَلَهُ قَبْلَ أَنْ يَخْلُقَنِي بِأَرْبَعِينَ سَنَةً قَالَ رَسُولُ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ فَحَجَّ آدَمُ مُوسَى» . رَوَاهُ مُسلم
From Abu Hurayrah, who said: The Messenger of Allah ﷺ said: "Adam and Musa, peace be upon them both, argued in the presence of their Lord, and Adam prevailed over Musa in argument. Musa said: 'You are Adam, whom Allah created with His Hand, into whom He breathed of His spirit, to whom He made His angels prostrate, and whom He settled in His Garden; then you brought the people down to the earth through your sin.' Adam said: 'You are Musa, whom Allah chose for His message and His speech, to whom He gave the Tablets in which is the explanation of everything, and whom He brought near in private conversation. How long before I was created did you find that Allah had written the Torah?' Musa said: 'Forty years.' Adam said: 'Did you find in it: And Adam disobeyed his Lord and went astray?' He said: 'Yes.' He said: 'Do you then blame me for doing a deed that Allah wrote for me to do forty years before He created me?'" The Messenger of Allah ﷺ said: "So Adam prevailed over Musa in argument." Reported by Muslim.