If you accept that God is omniscient, as Christians do, then he had to know that man would sin. Obviously, however, God felt that the good that humanity would do would outweight the evil. For every sin, there is an often unseen grace. For every damned soul, a saint. God felt the overall balance was for good in humanity.