Is there a way to know according to Scripture, whether King Solomon is in Heaven or Hell?
The testimony of Scripture is that Solomon was a believer. First, the text states so plainly:
Secondly, Solomon authored at least three books of Scripture (Song, Proverbs & Eccl), which would have been impossible were he not a believer and under the anointing of the Spirit of God.
Thirdly, the king is in the line of Jesus and there are no unbelievers in Jesus' family line:
Finally, Solomon was greatly used and blessed by God, and though he also sinned greatly, he turned back to a relationship with His Lord. As King David lay on his death bed, he spoke to Solomon:
David tried to encourage his son to not only obey the Lord, but to "walk" with Him – have a relationship with Him. We see evidence of this relationship in the times when God communed with Solomon (granting Solomon's request for wisdom and blessing him with wealth and fame in return, granting Solomon the privilege to rebuild the temple). Yet then his many wives entered the picture, and like many who lust after the world, Solomon strayed and worshiped their false Gods. So God took his kingdom (and his blessings) away from him.
However, near the end of Solomon's life, he wrote the book of Ecclesiastes. And at its conclusion, we find Solomon returning to the Lord, recognizing that He had drifted away from God and would be judged accordingly.
So since the condition for salvation has always been the same – by faith in the promises of God – that condition was not taken away upon Solomon's act of sinning.