Three broad approaches exist to explain the jarring discrepancy between the love and dedication that Shlomo displayed towards God and His Mikdash and his love towards foreign women that led to idolatry.
1) The approach adopted by the majority of traditional commentaries posits that Shlomo himself did not partake in idol worship but facilitated his wives’ idolatry and it is therefore attributed to him.
2) A careful read of chapters 9 and 10 points to a wide range of failures, a sense of spiritual disorientation identified by Shlomo's overconfident abrogation of the Torah's restrictions for a king. All these lead in a direct line to the more serious offenses of chapter 11.
3) Shlomo's marriage to Pharaoh's daughter at the very outset of his reign is a competing love to his love for God as is subtly described in the text and more explicitly described in the Midrash. Shlomo is caught ideologically between competing worlds. Bat Pharaoh represents Egypt, the power and trade, the skills and crafts, wealth and international control that appeal to Shlomo's imperial mind. These come along with a religious worldview that is polytheistic and pagan. On the other side is the Torah, the Mikdash, the path of David Ha-Melekh. Shlomo is committed to both. He seeks to balance the two, but he fails.