The argument (critical of either God or the Bible) runs as follows:
1) God can’t command the killing of children because that is an absolute evil.
2) Yet Old Testament passages refer to this kind of thing.
3) From that we conclude that either A) God is evil, or B) the Bible is in error and is being inaccurate about what God has done and His good and benevolent and all-loving nature.
I’ve written about this general issue many times, and will provide the links at the end, for more in-depth reading on the topic. But here was my spontaneous reply to the same sort of charges recently brought up:
God, as Creator, is also a Judge, and so can decide to judge a nation or a people if they become wicked enough. It doesn’t follow that every individual goes to hell, but the culture is judged: at times completely.
Normally, or normatively, the killing of innocent children is forbidden by man-made laws and the moral law. This holds in all situations except for the extremities of a situation where a culture has become so evil and corrupt that God Himself gives up on it, and judges it: which He, as Sovereign Creator, has the perfect prerogative to do. If God gives life, He can also take it away. Human beings (apart from just war or self-defense) don’t have that right. And so we think abortion is absolutely wrong.
But if a Christian holds that God’s commands about judging the Canaanites or Amalekites (if they actually occurred, as the Bible says they did) — particularly the children — would be evil, how do they deal with the Last Judgment and the Second Coming? Lots of children will die, then, too, by God’s express desire. In fact, (as far as I know) everyone will die; or at least their earthly sojourn will come to an end.
So if God can’t judge a culture 3000 years ago (if we say He wouldn’t and morally couldn’t do such a thing), how can He judge the whole world in the future, without sin?:
Revelation 19:11-21 (RSV) Then I saw heaven opened, and behold, a white horse! He who sat upon it is called Faithful and True, and in righteousness he judges and makes war.  His eyes are like a flame of fire, and on his head are many diadems; and he has a name inscribed which no one knows but himself.  He is clad in a robe dipped in blood, and the name by which he is called is The Word of God.  And the armies of heaven, arrayed in fine linen, white and pure, followed him on white horses.  From his mouth issues a sharp sword with which to smite the nations, and he will rule them with a rod of iron; he will tread the wine press of the fury of the wrath of God the Almighty.  On his robe and on his thigh he has a name inscribed, King of kings and Lord of lords.  Then I saw an angel standing in the sun, and with a loud voice he called to all the birds that fly in midheaven, “Come, gather for the great supper of God,  to eat the flesh of kings, the flesh of captains, the flesh of mighty men, the flesh of horses and their riders, and the flesh of all men, both free and slave, both small and great.”  And I saw the beast and the kings of the earth with their armies gathered to make war against him who sits upon the horse and against his army.  And the beast was captured, and with it the false prophet who in its presence had worked the signs by which he deceived those who had received the mark of the beast and those who worshiped its image. These two were thrown alive into the lake of fire that burns with sulphur.  And the rest were slain by the sword of him who sits upon the horse, the sword that issues from his mouth; and all the birds were gorged with their flesh.
That’s “meek and mild” Jesus: massively judging. Certainly this apocalyptic judgment will include many children (which, again, is not the same as consigning all of them to hell). How does a person who believes that a good God would never have commanded the utter annihilation of the Amalekites, deal with that? Christians believe in the Second Coming.
Those who think like this have to explain how the Second Coming and Final Judgment are not also “evil acts” of God, as described in the Bible. Yet if they throw those out, it seems like they are well on their way out of Christianity. They’re right in the Nicene Creed.
Moreover, it’s not evil for God to command a person to kill someone as a part of His judgment, either, because the judgment isn’t evil; therefore, the secondary cause isn’t doing an evil act. He or she is following a command of God to do a thing that is just and good.
Hence, for example, God even used the heathen Babylonian king Nebuchadnezzar to judge His own chosen people, Israel, when they had gone astray (Jer 27:6). He used St. Peter to judge Ananias and Sapphira with death, and that was in the New Testament. Peter didn’t kill them, but he made clear it was divine judgment (Acts 5:1-10).
If God can cause death, as Creator and Judge, and this is moral, then He can, by the same token, cause it by the hand of a human being, as His instrument:
Numbers 31:1-8 (RSV)  The LORD said to Moses,  “Avenge the people of Israel on the Mid’ianites; afterward you shall be gathered to your people.”  And Moses said to the people, “Arm men from among you for the war, that they may go against Mid’ian, to execute the LORD’s vengeance on Mid’ian.  You shall send a thousand from each of the tribes of Israel to the war.”  So there were provided, out of the thousands of Israel, a thousand from each tribe, twelve thousand armed for war.  And Moses sent them to the war, a thousand from each tribe, together with Phin’ehas the son of Elea’zar the priest, with the vessels of the sanctuary and the trumpets for the alarm in his hand.  They warred against Mid’ian, as the LORD commanded Moses, and slew every male.  They slew the kings of Mid’ian with the rest of their slain, Evi, Rekem, Zur, Hur, and Reba, the five kings of Mid’ian; and they also slew Balaam the son of Be’or with the sword.
God used Moses and his army to execute His judgment. It was not a complete judgment in this case (women and children were spared). There are many examples of such things in the Bible.
Photo credit: Four Horsemen of Apocalypse (1887), by Viktor Vasnetsov (1848-1926) [public domain / Wikimedia Commons]