In the development of racism as a system of oppression and subordination, both religion and secularism have played the parts of promoting racism and working against racism.
For most of human history, “racism” as we know it wasn’t really a thing. There were plenty of reasons for people to look down on other people, and justify killing them, but these reasons were things that were not inherited, like one’s parents being slaves because they were prisoners of war, but being eligible to become a citizen, or they were mutable, like that they were a heathen religion which you needed to convert from.
(Though I don’t really get how this doesn’t also include sexism, as being female in a sexist society is inherited, immutable and justified through bullshit biological essentialism? I know that there’s plenty of overlap in there, and that modern racism and modern sexism are enforced by similar mechanisms, but what bit of the definition excludes sexism and makes it specifically racism? I know they’re different, I’m just a stickler for making your definitions clean and airtight as possible.)
However, in the late Middle Ages, anti-Jewish sentiment in Spain led to the Alhambra Decree, in which King Ferdinand and Queen Isabella demanded that all Jewish people in Spain either convert, leave or die. Most chose to convert, since most don’t like to die, but their sincerity was questioned, and eventually it became that anyone who was of Jewish descendance was seen as having “impure blood”, whether or not they had converted to Christianity. No longer did Christ’s forgiveness spread to them, because it was the Jews who had killed him in the first place, and thus, their descendants were tainted forever.
But at the same time, in the Americas, it was Catholic missionaries who most vigorously defended the humanity of the American Indian. They were descendants of Adam and Eve as much as anyone else, they said, and therefore they had a soul, and therefore they could become Christian, on an equal level as any other before the sight of God. This was not a popular view, as most of the Spaniards who came to the New World came for plunder, and these savage people-like things were only getting in their way.
With the Enlightenment came the new tools of scientific reasoning, and with these new tools came new ways to justify and pick away at the prevailing racial order.
While Darwin’s “Origin of Species” had little in it about humans besides idle speculation, Charles Darwin’s cousin, Francis Galton had plenty of ideas about how evolution and selective breeding could “improve mankind” and it was around these ideas and the ideas of other, like-minded Victorians that the field of eugenics came about. Eugenics took the idea of “the survival of the fittest” (a term coined by English philosopher Herbert Spencer to describe the parallels between biological evolution and economic competition in a capitalist society) and applied it to human society, endorsing encouraging “fit” traits and discouraging “unfit” traits that just so happened to fit with their biases towards rich, white, able-bodied, Anglo-Saxon men being the superior model of mankind, and everyone else needing to be “discouraged” from breeding, often by forced sterilization and even genocide. The irony of the “fittest” needing extra non-natural help, as the “unfit” outsurvived and outbred their “betters” was completely lost on these men.
After the Nazi concentration camps of World War II showed the horrors of eugenics taken to its logical conclusion, most of the scientific community quickly recanted the project, and more thorough genetic testing showed that the differences between races of humans were less innate and much smaller than the scientists of the Victorian era had posited. In fact, it was science that showed once and for all that human beings of all races were the same species.
Both science and religion can be powerful tools to maintain and dismantle racism. Neither of these falls squarely on one side or the other.