I believe you are thinking of "The Earth Killers," by A.E. van Vogt. First published in Super Science Stories, April 1949, and it turns out that there's a copy of that issue of the magazine on Internet Archive. (Click on the "Super Science Stories" link and you'll find it.)
The original version does not seem particularly racist. The evil mastermind was a U.S. Senator who made sure he was delayed in Florida with "food poisoning" on the day that a bomb wiped out everybody in Washington, D.C (and many other American cities -- but no other nation was targeted, apparently). Then the Senator and a couple of Congressmen (implicitly they may be the sole survivors in terms of "elected officials of the Federal government") form a caretaker government and declare a six-month period of martial law. This seems to be widely accepted by U.S. citizens, because losing forty million people in a surprise nuclear strike obviously means that extreme measures are called for, temporarily, until the enemy has been found and dealt with.
Which is where our hero comes in -- Captain Morlake. (Probably United States Air Force, but I'm not sure if anyone ever says, in so many words, that he wears the uniform of an Air Force officer.) He happened to be test-flying a special aircraft when the rocket headed for Chicago went zipping down past him (this was when he was about 75 miles above the ground). He was unable to stop the rocket before it destroyed the city (although he certainly wanted to). But his careful description of its trajectory fails to correspond with what his superiors desperately want to hear, so he finds himself in a court-martial!
Here's an excerpt to show why I feel certain that this is the same tale you are remembering.
"Captain Morlake, you have heard witnesses testify that any bomb
accurately aimed from any point on the Earth's surface would have been
describing a parabolic curve of some kind at that height?"
"I have heard the witnesses."
"And what do you conclude from their testimony?"
Morlake was firm. "A short time ago I was convinced that our rocket
science was superior to that of any other country. Now, I know that
we've been surpassed."
"That is your sole comment on the deaths of forty million Americans.
We have been surpassed."
Morlake swallowed hard, but he controlled himself. "I did not say
that. The bomb was coming straight down."
"Hadn't you better think that over, Captain?"
Insinuating words. He knew what they wanted. In the short time since
the trial had been scheduled, the prosecution had had several bright
ideas. The previous night they had come to him with drawings of
hypothetical trajectories of bombs. Every drawing was on a map of the
world, and there were three different points of origin illustrated. If
he would agree that the bomb had been slanting slightly in any one of
the three directions, he would be a hero.
When he fails to cooperate by pointing the accusing finger at an unfriendly nation, he is convicted and sentenced to thirty years in prison. (The two charges in the court martial were that either a) he had made the whole thing up about seeing the bomb, giving a false report just to make himself seem important, or else b) he had given false testimony about the trajectory of the bomb, assuming he actually had seen it pass his vessel on its way down.)
As you say, it eventually turns out that a rogue group of Americans bombarded their own country from a secret base on the Moon, meaning that those rockets essentially came "straight down" to reach designated targets in North America. In the original version, the Senator, when cornered, doesn't make any racially-charged speeches about his motives as he dies (after being shot in the chest).
I know I first read this story in a much later paperback collection of many of the author's shorter pieces: The Worlds of A.E. van Vogt (first published in 1974). But I'm not sure where my copy is, so I can't check on what the Senator's exact motive was revealed to be in that version. A little Googling, however, brings up an anecdote, told in an interview with Charles Nuetzel, regarding some changes made to "The Earth Killers" for reprint publication in an anthology he was editing. The anthology was called If This Goes On, and here's what he says about the van Vogt story he included in it.
Another interesting sidebar concerned van Vogt's "The Earth Killers."
I wanted the van Vogt name, but the story didn't quite fit my rigid
rules of acceptance. I asked Forry if van Vogt could fix it to fit the
anthology's theme. The result was my getting a tear sheet copy into
which had been cut and pasted the revisions that gave the story the
social impact to fit my book. Only a true professional would handle
matters this way. Van Vogt was one of the Big Five in Sci-Fi. Yet, he
was willing to make the changes. And he was doing me more of a favor
than the other way around; quite obviously.
I don't believe I've ever read If This Goes On, but the ISFDB entry tells me it was first published in paperback in 1965. After reading that Nuetzel quote, and your recollection of the motivation in the version you once read, I strongly suspect that van Vogt elaborated upon the evil Senator's motives in revisions he made at Nuetzel's request, complete with making the Senator extremely racist so readers could cluck disapprovingly and feel morally superior. (As opposed to the original magazine version, where it simply seems to have been that the Senator was just plain power-hungry, rather than being bigoted against any particular group.)
Update. Here are some relevant excerpts from the last page (p. 110) of "The Earth Killers" as reprinted in this 1968 Ace edition of The Far-Out Worlds of A. E. Van Vogt. The expression [n-word] replaces a six-letter racial slur in the quoted text.
General Clark dropped down beside Morlake. "Senator," he said, "for God's sake, the name of the country, the enemy?"
The dying man looked at him with the beginning of a sneer on his lips.
"We got even with you [n-word]-lovers, didn't we?" he said. He laughed a satanic laughter, that ended hideously in a gush of blood. Slowly, the big head grew limp, the eyes though still open took on a sightless glare. A dead man lay on the floor.
The two men, Clark and Morlake, climbed to their feet. Morlake said in a low voice, "Gentlemen, you have your answer." He saw that they still did not comprehend what he had suspected for long now.
[. . . .]
The first atomic war had been, not an international, but a civil war. And now that Tormey was dead, the gang would scatter. A gang of race-prejudiced Americans.
The war was over. Irrevocably.