A couple of days ago, I had a discussion with a few atheists on Twitter on whether or not the Bible was a "moral book" or not. I challenged them to explain what moral system they could appeal to that would render the Bible an "immoral book". Rather than giving a legitimate answer, they instead pressed me to defend why I thought the Bible was a "moral book", which was a claim that I had never made. Confused, they asked if I agreed with them when they said the Bible is an "immoral book". I told them that I did not agree with that statement. So I deny the claim that the Bible is a "moral book" but I also deny that the Bible is an "immoral book". This then led them to throw all of the nasty things in the Old Testament (e.g. genocide, wars, slavery, ect) in an attempt to get me to agree with them that the Bible is an "immoral book".
The inherent problem with classifying the Bible as a "moral" or "immoral" book is that it is simplistic, engages in hardcore reductionism, and is a lazy way of not doing your homework when it comes to studying the Bible in an intellectual way. To summarize the entirety of the Bible and classify it as either a "moral" book or an "immoral" book is to ignore the vast amount of research and study that has gone into ANE (Ancient Near East) culture to help us understand the times and cultures of the Bible in a better way. For a worldview that claims to be the pinnacle of reason and rationality, they often take the most shallow, most anti-intellectual path possible when it comes to the Old Testament. Criticizing the Bible by calling it a "immoral" book is not a deep critique of the Bible - if atheists were truly about knowledge and reason, why are they not digging deep into ANE culture to get a better understanding of the things that happen in the Old Testament? Why is it that they often stop with a knee jerk reaction when the read of war and slavery and strange dietary laws?
Christian intellectuals explore the archeological, historical, sociological, and theological areas related to those things to attempt to understand a better picture of those things to see if there is anything about our understanding of those things that change once we understand them more fully. Paul Copan has written an excellent (and thorough) book called "Is God A Moral Monster?" that deals with all of the things in the Old Testament that are certainly difficult to deal with, and explores all of those areas (archeological, historical, sociological, and theological) in connection to the sticky parts of the Old Testament. If you want to hear a thorough Christian explanation of those things, I highly encourage you to check it out.