Hi, @jmcclana! This question/objection tends to come up a lot not just from atheists, but from Christians trying to understand as well. I myself still struggle at times with some of the stories in Joshua!
A couple of quick things to think through/add to @SeanO’s list would be…
Does God have the right to judge? This is often a foundational question for me because what’s going on in Joshua is that God is using the Israelites to bring judgement on both the Canaanites and their gods. (Similar to how God subsequently uses the Babylonians and Persians to judge Israel.) If God does not have the right, then He is no god. Embedded in the very definition of the God of monotheism is that God, as the creator and ruler of the universe and the One from whom nothing can be hidden, stands as judge over its inhabitants. Part of his job as God is the execution of justice. A natural question that then follows is…
Does God have the right to set out the terms of that judgement? Again, yes. As God, he has the right both to judge and execute justice.
Are those terms just by God’s own definition of just? This is another big question to explore. There are a couple of stories in Joshua make me cringe (‘Yikes, God!’) and ask, ‘Was that really necessary?’, but I remember that God knows everything fully and completely. I also wonder if I would have had the same reaction if I’d lived in that time period? The notion of wiping out of nation-states and the citizens therein (rather correctly) offends our modern, western sensibilities, but in a way, that was the way the world worked back then.
Oftentimes I’ve heard the objection that God is arbitrary, random, and unreasonable. He does whatever He wants, whenever He wants without any rhyme or reason or care. And to some extent, He does do whatever He wants, whenever He wants (Christians often refer to it as His ‘will’), but His will is not arbitrary. What God does (or ‘wills’) springs directly out of who He is - His nature - and He cannot do anything contrary to His nature. If justice is what He is, then, by definition, He cannot do an injustice.
Also, @billbrander’s question is a good one. By what standard of morality is one passing judgement on God? What exactly do they see as immoral?