If god made us in his own image, that would include free will. That would also include the capacity for good, and evil. God is not all good, he is both all good and all evil at once. He is everything, infinite. This is the paradox of divinity, and of infinity.
He allowed for humans to walk whatever path they would like. This world just IS, it's not good or evil. It was simply created for us to live in. Maybe pain was created as a foil for pleasure, just another paradox to explain the existence of equal and opposites. Humans, like God, simple ARE as we are and how we choose to be. The nature of the universe we live in is of probability, of circumstance. Nothing in this world is anything but circumstance, and yet we also have free will to live in such a random world.
I'm not religious at all by the way, I just believe in math and probability. This is just my own personal view of the world.