There is a lengthy discussion going on in Hirhurim about the commandment to wipe out Amalek. Some of the people there are bothered by the fact that the Torah tells us to indiscrimantely kill all Amalekites (men, women and children), what we would call today genocide. Some are bothered by the fact that the Torah seems to be racist, all Amalekites are killed indiscriminately regardless of what they did just because they are a member of Amalek. I would like to lay out what I believe as a frum Jew.
Let's start with some basic principles. The following should be agreeable to any Orthodox Jew:
1. Torah min hashamayim, the Torah is the revealed word of Hashem
2. The Torah is not changing
3. The Torah is the blueprint for the world הסתכל באורייתא וברא עלמא)
4. Hashem is omniscient and perfect
Give the above principles if the Torah tells us to do something it is by definition moral, correct etc. How could it be anything else if it is the word of Hashem? Would Hashem command us to do something immoral or unjust? We are commanded to imitiate Hashem, we are supposed to be merciful because Hashem is merciful (מה הוא רחום אף אתה רחום). Therefore, if the Torah tells us to kill all the Amalekites then we need to accept it as the word of Hashem and not have any moral qualms about it. We may not understand it, like we don't understand many things (צדיק ורע לא רשע וטוב לא) but we need to have faith that what we are doing is the will of Hashem and therefore the correct/moral thing to do.
Hashem commanded Avraham Avinu, the paragon of chessed to kill his only son and offer him as a sacrifice. Was that a moral command? Avraham Avinu is praised and we have the זכות of the עקידה forever specifically because he unhesitingly obeyed the command of Hashem without any qualms.
As soon as we start to inject our own views about what is moral and what is not, everything becomes subjective. For some people, euthanasia of babies with severe birth defects is moral. (see for example Netherlands grapples with euthanasia of babies). From their perspective they are performing a kindness to the child, a mercy killing, others claim that this is outright murder. How are we supposed to decide who is right? Is abortion murder or should it be permitted on demand? These are all moral questions where a thinking person can easily see both sides of the question. Only by adopting the objective Torah viewpoint can we know what is truly moral and what is not.
With regards to the charge of racism, I say that Judaism pleads guilty. Judaism discriminates in many ways solely by birth. Someone who is born as a גוי has less קדושה then a Jew and is discriminated against by the Torah. Someone who is born to an Amalekite is to be killed. Someone born a ממזר is discriminated against because he is a ממזר, he can't marry my daughter, he can be the biggest torah sholar but he can't serve on the Sanhedrin. Someone who is not born a כהן can never do the עבודה. The משיח will only be a descendent of David, in fact, Judaism mandates a hereditary kinsgship. The list goes on.
The mishna in הוריות יג states that regarding charity and freeing of captives a כהן is before a לוי who is before a ישראל who is before a ממזר. The gemara comments that this is if they are equal in torah. In other words, if you have a ממזר and a ישראל in jail and they are equal in torah you free the ישראל first period.
The Torah assigns different roles to different people and discriminates between them. The Torah does not believe in the American dream, not everyone can be the King, work in the Beis Hamikdash, be on the Sanhedrin etc. Women have a different role then men and this is borne out in Halacha. A person's goal in life is to fulfill his task and this is what he is judged on when he dies. When Joe Shmo dies they will not ask him in שמים why weren't you the Vilna Gaon, they will ask him why didn't he fulfill the potential and perform the task of Joe Shmo. If we look at life with that perspective then the fact that the Torah discriminates is irrelevant, that is part of Hashem's plan. You were born who you were (ישראל,כהן,ממזר )with a given task to fulfill given the parameters of your birth. All you need to do is fulfill your task