Or to put it in the words of Jesus in Matthew 6:33, Solomon seeks first God's kingdom and God righteousness and all of these things are added unto him as well. Righteousness and justice are closely related terms in the Bible. Therefore, for Solomon to ask for wisdom to rule justly is to ask that God's righteousness become a reality through his reign as king over Israel. It is to ask that Solomon be so wise in his reign that it were as though God himself were reigning in Israel; that Israel's kingdom be God's kingdom. This is, of course, precisely what God's anointed leader for God's chosen people should pray. Israel was always supposed to be God's kingdom and the manifestation of God's righteousness within the world.
But what about the places in the story where Solomon does not act wisely or righteously? Of course, there are several stories that demonstrate the incredible wisdom that God gives to Solomon like the very next passage later in 1 Kings 3. However, Solomon also does several things which would certainly be counted as unwise and unrighteous by the standards of the Hebrew Scriptures. He marries women from foreign nations and we learn latter in 1 Kings 11 that these wives even lead Solomon to worship gods other than Yahweh. Solomon offered sacrifices on the "high places", which were probably pagan places of worship, rather than offering sacrifices in the Temple which God had given Solomon the privilege of building. We also find that Solomon makes his own palace larger and more magnificent that the Temple that he built for God, presumably with the same forced labor that built the Temple. Certainly, that is not the wisdom and righteousness of God at work, is it?
I guess we should come to expect this ambiguous mix of righteousness and unfaithfulness by this point in the story. These narratives of Israel's history are brutally honest about the imperfections of Israel's leaders. We saw the same thing in the story of David who was a model for all the kings after him and yet still had very serious flaws. Israel refuses to whitewash the stories of its leaders while simultaneously recognizing that these leaders were gifted by God in special ways in spite of their sins.
This is an encouragement to us as the Church. We know that we are sinners. Like Solomon, we recognize our inadequacy as we face the tasks that lie before us. We can not save this world. We can not even save ourselves. But God can still give us gifts and graces for his work in this world so that even in the midst of our sinfulness we can still pray and live the prayer "thy kingdom come, they will be done on earth as it is in heaven."