Addressing this topic on any SE site has proven to be particularly interesting; this users' questions and answers relating to "race" have been deleted at both History SE and Politics SE; which should provide some context into the limited scope available to thoroughly address the subject matter at SE site.
First, we would need to locate the origin of the concept of "race" historically. For example, according to statistics, no "black" people currently exist in Germany.
For that we can examine the invasion of Alexander into Ancient Egypt. Thereafter the creature "Serapis" was created. "Serapis" then became "Jesus the Christ", with the later accompanying image of a "white" man as "God". How this is the origin of "racism" began from an historical perspective. Ptolemy wanted to be worshiped as a deity within the pantheon of Ancient African Egyptians, though was rejected by the temple societies, until finally allying with a temple society which ultimately became the religion Christianity. The details are far too complicated to attempt to post in this answer, as SE users have frequently commented about the length of questions and answers, will instead refer to The Historical Origins of Christianity by Walter Williams.
It must be noted here that such alliances between so-called non-"white" people and "western" powers still exists, and is as challenging to precisely document the origins of how such alliances came into being as the concept of "race" itself, see How is Phi Beta Kappa and Skull and Bones historically connected to Sigma Pi Phi fraternity also known as the Boulé?; meaning, just because an individual appears to be "black" does not mean that their culture is "African"; their allegiance can be to the current Ptolemy. Similarly, it would be an grievous error to omit John Brown and his sons from consideration as to the issues with attempting to assign a blanket system of "race" values to any group of individual; where their actual culture and politics could very well be more adversarial or common than expected based on some arbitrary pre-conceived notion of the political classifications. Just because an individual self-identifies as "black" or "white" or any other political classification does not mean that they share an ideological, philosophical or political perspective and will act according to what the other individual "believes" is the proper and understood collective mode of operation.
There exist alternative theories of the origin of "race", from the intentional creation of the "tamahu" by "Yacub" to Darwin grappling with various non-human traits in some of mankind.
The fact is that there is no universally accepted definition of "race", though some in academia have come close to, from perspective here, providing a valid definition, including
AAA (American Anthropological Association) Statement on Race
How people have been accepted and treated within the context of a
given society or culture has a direct impact on how they perform in
that society. The "racial" worldview was invented to assign some
groups to perpetual low status, while others were permitted access to
privilege, power, and wealth. The tragedy in the United States has
been that the policies and practices stemming from this worldview
succeeded all too well in constructing unequal populations among
Europeans, Native Americans, and peoples of African descent. Given
what we know about the capacity of normal humans to achieve and
function within any culture, we conclude that present-day inequalities
between so-called "racial" groups are not consequences of their
biological inheritance but products of historical and contemporary
social, economic, educational, and political circumstances.
and; in Working DefinitionsRace, Ethnic Studies, and Early American Literature by Joanna Brooks
First, a few working definitions: race, as I understand it, is an
effect of racism. The idea of race came into being as a means of
organizing social relations in order to establish and maintain
political and economic domination. Racial categories assume meaning
over time through ongoing interplays of political, economic, cultural,
and social forces. Likewise, through collective intellectual,
political, cultural, and spiritual action, racialized groups can
redetermine the meaning of the identities imposed on them.1
I have also been influenced by the definition of whiteness propounded
by Noel Ignatiev, John Garvey, and other scholars affiliated with the
Race Traitor project. The first paragraph of their charter statement
reads: "The white race is a historically constructed social formation.
It consists of all those who partake of the privileges of white skin
in this society. Its most wretched members share a status higher, in
certain respects, than that of the most exalted persons excluded from
it, in return for which they give their support to a system that
degrades them" (9). In exchange for their complicity with a system
that compromises the life chances of people of [End Page 313] color,
"white" people gain privileged access to resources. "Whiteness" is
experienced as a form of property, as social, political, economic, and
cultural capital.2 Racialization into dominance degrades the humanity
of so-called white people, while racialization into exploitation
endangers the life chances of people of color. Consequently, race is
never just a neutral social fact or an inert historical condition.
Academic discussions of race are always embedded in and shaped by the
broad array of historical forces and movements that give race its
meanings. Thinking, talking, and writing about race in America means
transacting in matters of life and death, confronting the human
capacity for profound creativity and visionless abandonment. It is an
enterprise I find both sobering and emancipatory.
Some of this users' questions and answers do survive at SE sites, for the time being, which will list below for further review. The first use of "white people" that was able to locate in literature is in The Triumphs of Truth by Thomas Middleton (1613). The first usage of "white race" that could locate was in the 17th century in An Essay on the Inequality of the Human Races by Arthur de Gobineau (1853-1855)
The white races are, further, distinguished by an extraordinary
attachment to life. They know better how to use it, and so, as it
would seem, set a greater price on it; both in their own persons and
those of others, they are more sparing of life. When they are cruel,
they are conscious of their cruelty; it is very doubtful whether such
a consciousness exists in the negro. At the same time, they have
discovered reasons why they should surrender this busy life of theirs,
that is so precious to them. The principal motive is honour, which
under various names has played an enormous part in the ideas of the
race from the beginning. I need hardly add that the word honour,
together with all the civilizing influences connoted by it, is unknown
to both the yellow and the black man.
see Who is the first person in the 17th century to describe themselves as a “white” person and who invented the term “white race”?.
The first use of "White-woman" law in the colonies of Btitain in the western hemisphere can be traced to 1681 in Maryland Colony, and largely dealt with "white-women" having sexual relation with and marrying non-"white" men, see Was race really unimportant in the 1660's?; Birth of a White Nation: The Invention of White People and Its Relevance Today by Jacqueline Battalora; see also What are the legal requirements in the United States for being recognized under federal law as “white” or a “white” person?; Is the term “race” defined by Public Law enacted by Congress of the United States.
"race" in the United States is based on self-identification. No individual is born being a member of any fictitious "race"; further, individuals can decide to self-identify with any "race" they choose; including the once official "some other race"; see Rachel Dolezal: 'I don't identify as African-American, I identify as black' (Source: today.com); Black teen stuns TV host Dr Phil by claiming she's a 'white person' and identifies with the KKK (Source: indy100.com).
Essentially, the modern concept of "race" is a relatively recent phenomenon, with an origin in the 19th century, the primary purpose being the establishment of the criminal enterprise "white supremacy". Given that "white supremacy", as an institution, is the most powerful government currently in existence, the act of thoroughly investigating the etymology, meaning and application of "race" is one of the most challenging endeavors an individual can undertake.
To openly state that "race" is a purely political construct designed to confuse and control various classes of individuals requires close examination of the core of the term "race" itself, and for individuals to ask themselves why they self-identify with any fictitious "race"; which few are want to do; as they are challenging the status quo, with little expectation of individuals or groups at large abandoning the practice of self-identifying with any "race", including when asked by the state to assign oneself into a fictional political class.
From perspective here, the invention of "race" is the biggest fraud ever to be perpetuated.
Must read: The Invention of the White Race, Volume 1 Racial Oppression and Social Control and The Invention of the White Race, Volume 2 The Origin of Racial Oppression in Anglo-America by Theodore Allen.