Indeed, Solomon loved many strange women, and those wives led him astray to worship other gods.
Paul was not mincing words or joking when he told his fellow believers in Christ not to marry people who were unsaved:
"Be ye not unequally yoked together with unbelievers: for what fellowship hath righteousness with unrighteousness? and what communion hath light with darkness?" (2 Corinthians 6: 14)
Yet even under the Old Covenant, and the reteaching of the law during the ministry of Nehemiah we see the grace of God at work.
In the verse, we see what made Solomon a great king.
It had nothing to do with what Solomon did. It had everything to do with God!
More specifically, Solomon was beloved of the LORD!
Today, we are made kings and oruests through Christ Jesus::
"But ye are a chosen generation, a royal priesthood, an holy nation, a peculiar people; that ye should shew forth the praises of him who hath called you out of darkness into his marvellous light:" (1 Peter 2: 9)
God so loved us, that He sent His only begotten Son to die for us and as us, to give us His life (John 3: 16)
We are beloved of our loving Father today, because of Jesus:
"Blessed be the God and Father of our Lord Jesus Christ, who hath blessed us with all spiritual blessings in heavenly places in Christ: 4According as he hath chosen us in him before the foundation of the world, that we should be holy and without blame before him in love: 5Having predestinated us unto the adoption of children by Jesus Christ to himself, according to the good pleasure of his will, 6To the praise of the glory of his grace, wherein he hath made us accepted in the beloved." (Ephesians 1: 3-6)
Notice that we are accepted, highly favored, in "the Beloved", our Lord Jesus!
Just as Solomon was beloved of God, and thus made the greatest king, so too we are favored in the Beloved Jesus, and blessed because of Him!