WASHINGTON — Bill Clinton was called the first black president because he crossed racial lines so easily, a distinction he lost when Barack Obama became the first actual black president. But for decades, some Americans claimed that the nation’s first black president was really Warren G. Harding.

It turns out that he wasn’t, really. At least that is the result of new DNA testing that according to scientists showed for the first time that Harding almost certainly had no recent ancestors with African blood, despite assertions that were spread far and wide a century ago in efforts to sabotage everything from his marriage to his political career.

The finding was overshadowed last week by the determination through the same testing that Harding did father a child with a mistress, Nan Britton. But the conclusion about Harding’s racial ancestry likewise addresses a mystery that had puzzled historians for many years and provides a seemingly definitive resolution of a subplot that played out during his lifetime.

For Mr. Clinton, of course, the sobriquet of first black president was meant as a compliment, and for Mr. Obama a historical accomplishment. But for Harding, raised in a vastly different era, when Jim Crow governed much of the country and the Ku Klux Klan was making a comeback, it was a weapon wielded against him. Operating under the so-called one-drop rule that any “black blood” at all made someone black, racists used genealogy to try to discredit opponents.