Koran 2:102 claims that King Solomon did not disbelieve:
They followed what the evil ones gave out (falsely) against the power of Solomon: the blasphemers Were, not Solomon, but the evil ones, teaching men Magic, and such things as came down at babylon to the angels Harut and Marut. But neither of these taught anyone (Such things) without saying: “We are only for trial; so do not blaspheme.” They learned from them the means to sow discord between man and wife. But they could not thus harm anyone except by Allah.s permission. And they learned what harmed them, not what profited them. And they knew that the buyers of (magic) would have no share in the happiness of the Hereafter. And vile was the price for which they did sell their souls, if they but knew! (Yusuf Ali)
Yusuf Ali’s translation is not clear but M. M. Ali’s translation reads: “And Solomon disbelieved not, but the devils disbelieved, teaching men enchantment.” M. M. Ali notes that this contradicts our earliest source on the matter, 1 Kings 11:1-13:
1 Now King Solomon loved many foreign women, along with the daughter of Pharaoh: Moabite, Ammonite, Edomite, Sidonian, and Hittite women, 2 from the nations concerning which the Lord had said to the people of Israel, “You shall not enter into marriage with them, neither shall they with you, for surely they will turn away your heart after their gods.” Solomon clung to these in love. 3 He had 700 wives, princesses, and 300 concubines. And his wives turned away his heart. 4 For when Solomon was old his wives turned away his heart after other gods, and his heart was not wholly true to the Lord his God, as was the heart of David his father. 5 For Solomon went after Ashtoreth the goddess of the Sidonians, and after Milcom the abomination of the Ammonites. 6 So Solomon did what was evil in the sight of the Lord and did not wholly follow the Lord, as David his father had done. 7 Then Solomon built a high place for Chemosh the abomination of Moab, and for Molech the abomination of the Ammonites, on the mountain east of Jerusalem. 8 And so he did for all his foreign wives, who made offerings and sacrificed to their gods.
9 And the Lord was angry with Solomon, because his heart had turned away from the Lord, the God of Israel, who had appeared to him twice 10 and had commanded him concerning this thing, that he should not go after other gods. But he did not keep what the Lord commanded. 11 Therefore the Lord said to Solomon, “Since this has been your practice and you have not kept my covenant and my statutes that I have commanded you, I will surely tear the kingdom from you and will give it to your servant. 12 Yet for the sake of David your father I will not do it in your days, but I will tear it out of the hand of your son. 13 However, I will not tear away all the kingdom, but I will give one tribe to your son, for the sake of David my servant and for the sake of Jerusalem that I have chosen.” (ESV)
It is also worth noting that the author of 1 Kings referred his readers to the now lost Book of the Acts of Solomon (11:41) if they wanted to know more about King Solomon. It is unlikely that the author of 1 Kings would have lied about Solomon’s sins when his readers could check his story (not that there is any reason to believe he lied in the first place). It is far more likely that the Koran contains an historical error.