Can the great King of Israel Solomon be counted as a righteous person even though we have records of his sins? Because he wrote the book of Ecclesiastes and ended the book with some strong words which exhort us to fear God and keep His commandments, I believe he did repent unto righteousness. But what is the Orthodox Jewish belief about King Solomon’s ultimate standing with God?
Both your question and your answer are correct. The Tannaic (ancient) rabbis thought at one point to add Shlomo (King Solomon) to the list of the three kings who have no share in the World to Come, but G-d corrected them, and emphatically answered that his verdict is that of righteousness, and he apparently repented (Yerushalmi Sanhedrin ch. 10; Tanchuma Metzora 1).