Solomon was certainly not wise when he first succeeded David. At 1Kings 1:52, he said that he would not harm Adonijah as long as he showed himself a worthy man. However, in chapter 2, he ordered the death of Adonijah merely because he sought Solomon's approval to marry a woman. He punished the priest Abiathar, who had previously helped Adonijah, and Joab who did not, although he later befriended him. Then he ordered Shimei, who had not been allied with Adonijah, never to leave Jerusalem. Afterwards, Shimei briefly left Jerusalem to recapture and bring back his slaves, so Solomon had him killed. Solomon has demonstrated his lack of good judgement, as a foil for the qualities he would soon display.
Shortly after this, Solomon, in a dream, asked God for wisdom.
Soon after God granted Solomon wisdom, two women asked for judgement over the ownership of a small baby. In this episode, Solomon gave his most famous judgement, the only biblical example of his great wisdom. Solomon, with his profound wisdom, just knew that only one woman would be willing to give up her claim to the child rather than have it killed. Whether the insight this passage describes was really wise can be a matter for our own judgement.
According to the Bible, Solomon demonstrated no political wisdom, nor even sufficient common sense to govern wisely in the interests of his own son's succession to the throne of the United Monarchy. The Bible tells us that Solomon's reckless spending and swingeing taxes, maintained by his son, were the cause of the breakup of the United Monarchy. In spite of his supposedly personal knowledge of God, 1 Kings chapter 11 says that he unwisely began to worship other gods.
The biblical evidence shows Solomon not to have been a wise ruler, either before or after the gift of wisdom, but Jewish tradition has built up an image of Solomon as a great and wise ruler. Psalms that show any evidence of wisdom have been attributed to him, as have the wisdom books of Proverbs and Ecclesiastes. The Jewish people needed a glorious past, with both great and wise rulers. Solomon became part of that past. So, although not actually a wise ruler on the biblical evidence, he became well known in tradition as a wise ruler.