Abdullah bin Amr bin As reported,

The Messenger of Allah ﷺ reported that Sulayman bin Dawud ﷺ, when he completed the building of Bayt al-Maqdis, asked Allah عز وجل for three things. He asked Allah عز وجل for judgment that would conform to His judgment, and he was granted it. He asked Allah عز وجل for a kingdom that would not befit anyone after him, and he was granted it. And he asked Allah عز وجل, when he had finished building the mosque, that no one would come to it intending nothing but prayer within it except that he would leave free of his sins as on the day his mother bore him.

Azami 8467

Sahih

عن عبد الله بن عمرو

عن رسول الله: أن سليمان بن، ﷺ: أن داود ﷺ لما بنى بيت المقدس سأل الله عز وجل خلالا ثلاثة: سأل الله عز وجل حكما يصادف حكمه فأوتيه، وسأل الله عز وجل ملكا لا ينبغي لأحد من بعده فأوتيه، وسأل الله عز وجل حين فرغ من بناء المسجد أن لا يأتيه أحد لا ينهزه إلا الصلاة فيه أن يخرجه من خطيئته كيوم ولدته أمه.

الأعظمي 8467صحيح
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Stories of the prophets
Chapter
Reports of Sulayman عليه السلام
Section
Three qualities that Sulayman عليه السلام asked for
Numbering
Jami al-Kamil 8467 (2nd edition)
Azami 8467