I know that Thomas was the son of a nobleman, and that his father recognized him as a son and gave him a good education. It is also not hard to imagine that being the son of a nobleman protected Thomas from the worst of the racist ideas of that time but how did he manage to achieve such a high rank in the french army?. His life must have been an uphill battle
Note: My answer is strictly a historical view of French ideology of concepts such as race. I am not French, and what is written applies only to the historic period in question.
This is a great question, in that it highlights how often a "Western" mindset is melted down into really a British/American point of view. Certainly not criticizing your question--it's a great and valid question, particularly because it seems that Engligh-language historians have not fully addressed French attitudes toward race and slavery outside of the context of Saint-Domingue, where such issues mirrored American attitudes far more closely. I recently read a book by a historian of abolitionism that went to great lengths to get across the fact that it would include the French story of abolitionism. While covering decently (but not very comprehensively) the Société des Amis des Noirs (Society of the Friends of the Blacks), France's premiere abolitionist society, the French story ends with their literal abolition of slavery--something that would not be done in either Britain or the US for another 50+ years--in a single paragraph that takes this, unfortunately, typical point of view:
"[the decree ending slavery] in many ways was an act of desperation and one unconnected with either the Société des Amis Noirs or, for that matter, humanitarian sentiment."
Now, to be fair, it does appear that the author is referring purely to the declaration of the commissioners on Saint-Domingue, at that time in full-scale revolt due in part to the complex race-relations between white slave-owners, the free black population (some of whom were also slave-owners) and the black slave population; however, he never clarifies this statement, and leaves the story suggesting that even the idealistic revolutionaries were purely motivated by non-humanitarian sentiments (pg. 103-104).
I start here, because this view from historians has led to an imcomplete notion of the complex French approach to race and slavery. This isn't to glorify the French--certainly there was a sense of expidiency and political value in abolishing slavery, and the race relations on Saint-Domingue itself were largely fueled by racist sentiments--but it's also a bit odd at how little attention the French example has received. From the historiography, I get the sense that two factors are at play here:
To move, now, to the topic of race in 18th century France. While the Enlightenment--and especially the American & French Revolutions--are often linked as a network of great thinkers, that does not mean that agreement on all topics spanned the Atlantic. Slavery was an issue that cleaved the American founding fathers from their French counterparts in thought. One important aspect was that in the United States slavery was a visible and omnipresent problem--there were slaves within the country--while this same system did not extend to mainland France. For the French who had never been to the colonies, slavery was thought of as a distant problem. While US abolitionists had to contend with widespread racism fueled by large free black populations living amongst whites, the sight of a black individual was a rarity in France.
This does, however, contrast sharply with the views of the French on Saint-Domingue. The French colonists, involved in a power struggle with a fairly large and powerful population of free black and mixed race individuals on the island, routinely used the language of race in an attempt to keep those of non-European heritage subservient. Often, the lobbying of the white planter class affected policy back in France--for instance, in the "Code Noir" of Louis XIV, freemen were guarenteed full rights regardless of skin color; however, due to pressures from the white French colonials, these rights were often neglected on the island itself, and the right of free black men to vote was largely ignored.
Yet while the colonials had the weight of economic pressure that they could use to bully the French government into certain racist laws (or lack of enforcement of equality), there wasn't a development of the same racically-based ideology back on the mainland. While scholars can disagree--and there certainly is far more room for scholarship on this topic--the mainland French generally did not discriminate against men of dark skin color as an entire body, as did many Americans. This mostly accomodating view extended mainly to the mixed-race sons of French noblemen, who had borne children with black female slaves. Given the social status of these men, and the fact that mainland France valued social hierarchy (i.e. noble status) more so than skin color, these men were typically absorbed into French society without a level of ostracism we would expect. There certainly were racist attitudes--the French enslaved black populations, not white--however, there never was a widespread ideology that saw all black men as inferior; therefore, men such as Thomas-Alexandre Dumas could integrate into the mainland French society in a way that was far less contentious than relations on Saint-Domingue would suggest.
Men such as Vincent Ogé and Touissant Louverture, who were disgusted by the attitudes and actions of the white French population in Saint-Domingue, by all accounts were accepted in mainland France without issue. While they were frustrated by the white colonial lobbyists who managed to control the National Assembly through the first year of the Revolution, both men associated freely with the elite: both Ogé and Louverture attended at least one meeting of the Société des Amis des Noirs, and there is an anecdote of the former attending a dinner at Lafayette's in full military regalia.
Increasingly, the attitude of the white colonials in Saint-Domingue frustrated the delegates of the National Assembly, whose views were toward economic prosperity in the colony (a large revenue source) and fostering a spirit of national identity that was in the "Spirit of '89"--a natural rights of man prefaced on the Declaration of the Rights of Man. It was this latter document that gave the white planters trouble, as increasingly the mixed-race noblility of Saint-Domingue questioned why these same rights did not apply to them--however it's crucial to note that men such as Ogé did not wish to free the slaves; he wished to gain equal citizenship as a lawful Frenchman. The delegates of the Assembly, on the whole, were sympathetic to such arguments, but it wasn't until 1791 that men of all skin colors were granted voting rights.
As the Revolution became more radical, the Declaration of the Rights of Man took on an increasingly literal meaning. While earlier generations of Frenchmen on the continent had been inclined to accept the wealthy mixed-race gentlemen into their society, typically caring more about noble lineage (passed through the father) than skin color, the Revolutionaries were inclined to extend their egalitarian views outside the nobility. Two prominent examples were: First, Jean-Baptiste Belley, a former slave of full Sengali descent, who was elected to the National Convention and sat with the Montangard. (Note: I cannot find an actual source for the names, but Robespierre, Belley, and another gentlemen of "mulatto" descent brought the abolition decree to the floor of the Convention.) Belley was an elected representative from Saint-Domingue, and had purchased his freedom some decades earlier. The other man was Zamor, a servant in the household of Mme du Barry who was from Bengal (but perhaps of African descent) and who had been an early member of the Jacobin club, where by all accounts he was accepted without notable incidents of racism.
One last aspect that helps explain why men such as Dumas were able not only to live relatively unmolested in mainland France, but were actually able to rise to great prominence, was that the Revolution had opened the door for merit. Particularly after 1792, men of talent were sought out especially for the depleted military command; this helps explain how a young and by all accounts extremely talented military officer could rise up the ranks regardless of skin color.
A final note on "bastard" status--so long as you were recognized by your father, which Dumas emphatically was, no one care. The royal family routinely "legitimized" their sons and daughters outside of marriage, and the same priviledge was typically available to noblemen as well. For the illegitimate offspring of a white French colonial and a black female slave, all that was required was a fine; there were certain other laws that were usually able to be circumvented with the right amount of money and ingenuity.
Hopefully at this point, then, it's easier to see why Dumas, the son of a white nobleman, was treated in a manner that would have been very unusual--if not impossible--in contemporary America. While the French colonials in Saint-Domingue had an entrenched racist attitude that both sought to keep black slaves in subjugation, and overpower their sometimes allies, often enemies in the mixed-race/black platner class, these attitudes were not widespread in mainland France, which had a far more engrained social hierarchy based on class distinction and thus tended to not acquire the same racist notions that were common to Saint-Domingue and the United States.
Let me know if you have any further questions!