This quote is commonly paraded around as an accurate reflection of an institutional zeitgeist:
I am hard, but I am fair! There is no racial bigotry here. I do not look down on [various curses; the moderators prefer the quote presented as such]. Here you are all equally worthless. And my orders are to weed out all non-hackers who do not pack the gear to serve in my beloved corps. Do you maggots understand that?
While it's impossible to tell what an individual Marine's experience might have been with regard to racism during their individual enlistment, including training, the Marine Corps of the Vietnam era was subject to the same sort of racial biases, at least on an individual level, as the general makeup of the country of the time.
General Louis H. Wilson Jr., the 26th Commandant of the Marine Corps, clearly felt that racial animus in the Marine Corps was a significant enough concern to embark on a wide-ranging purge of the service after the Vietnam conflict drew to a close, with an estimated 15,000 Marines being involuntarily separated from service. While drug abuse in the ranks was a stated concern, the presence of white supremacists, black radicals, and other racially-tinged radical elements was also one of Wilson's stated reasons for the push.
This tension wasn't simply a figment of the general's imagination - in 1969, a brawl along racial lines on Camp Lejeune, one of the three largest concentrations of Marine forces to this day, resulted in a death and widespread reporting on a national level. A subsequent investigation by Col. Louis Hollier explicitly described the situation as one resulting from a Marine Corps that was "returning Marines, both black and white, to civilian society with more deeply seated prejudices than were individually possessed upon entrance to service."
Racial tension and prejudice on an individual level doubtlessly affected training, as the training process was at the time, and remains, a deeply human process involving close, unsupervised time in which drill instructors control most aspects of a recruit's life. That's not to say that introducing racial prejudice into the mix wasn't, at least officially, against policy; Col. Hollier's report ascribed the proximate cause of the Lejeune riot to Marines not abiding by existing directives on racial agitation. The entire Department of Defense, and with it the Marine Corps, had been desegregated since 1948, and the average Marine would have been living their daily lives in an organization with a higher degree of racial integration than one might find in civilian society at the time.
The structure of boot camp today remains fairly similar to its Vietnam iterations - deliberately hectic, opaque, and stressful, with any insecurity or point of difference becoming a target for drill instructors to press recruits on. As in the film, many of these would have likely been racial. It's difficult to tell how far the depiction of GySgt Hartmann mirrors that of the specific behavior of drill instructors any one Marine might have encountered, although it's worth noting that the actor portraying him, R. Lee Ermey, was himself a drill instructor from 1965 to 1967, and drew substantially from his own experiences in the portrayal.
(In a curious digression, Ermey's portrayal has become so deeply ingrained into the American public consciousness as the archetype of the military trainer that it has influenced actual Marine DI's, with his general mannerisms, demeanor, and even specific sayings mirrored by DI's to this day, making his case one of life imitating art that was originally itself imitating life.)
In sum, the Marine Corps of the Vietnam era was absolutely not free of the racial tensions, prejudices, and even outright racially-motivated violence that plagued the rest of American society during the time, with it being severe enough that it became a matter of concern at the top levels of the Corps. However, the portrayal of Hartmann was drawn from life, and individual Marines may well have held similar sentiments or encountered a training process in which an individual drill instructor's approach might well have been equally pejorative to all.
While your question is reasonable, we do not allow the use of slurs on this subreddit (though I realise you're quoting from a film). Please edit your question to remove the slurs and resubmit.