By wisdom the LORD laid the earth’s foundations,
by understanding he set the heavens in place;
by his knowledge the deeps were divided,
and the clouds let drop the dew.
The Holy Bible : Today’s New International Version. 2005 (Pr 3:19–20). Grand Rapids, MI: Zondervan.
It took intelligence to make the universe. More than that, it took wisdom–the ability to understand what was being made and what the consequences might be of that creating. Only God could create a universe that was as good as it gets, given the existence of sentient beings within it that had free will. God decided that his creatures having freedom was worth the consequences. He’d rather we be free than good. If you doubt that, consider that God left Adam and Eve free to choose to obey or disobey. If goodness was more important than freedom, he wouldn’t have granted it to them. Everything that has happened since Adam and Eve made their poor choices was worth it to God; to him, it was better than the alternative of no freedom.
And consider: which sort of society do you prefer? Western liberal democracies or a Nazi totalitarianism? Where would you rather live?