The White House said Tuesday that President Trump has been better for black Americans than President Barack Obama was, creating three times as many jobs for them as his predecessor — a statistic that turned out to be incorrect.

White House press secretary Sarah Huckabee Sanders responded forcefully to allegations by former White House aide Omarosa Manigault Newman, who is black, that Mr. Trump is a racist.

“This is a president who cares about all Americans,” she said.

She said in eight years under Mr. Obama, a total of 195,000 jobs were created for black workers, and Mr. Trump’s policies have tripled that number in less than two years.

“This is a president who is fighting for all Americans, who is putting policies in place that help all Americans, particularly African-Americans,” she said. “This president, since he took office, in the year and a half that he’s been here has created 700,000 new jobs for African-Americans. When President Obama left after eight years in office …. he had only created 195,000 jobs for African Americans. President Trump in his first year and a half has already tripled what President Obama did in eight years.”

But data from the U.S. Bureau of Labor Statistics shows that while the U.S. economy has added about 700,000 jobs held by black workers since Mr. Trump took office, employers added about 3 million jobs for black workers while Mr. Obama was in office for two terms.

Mrs. Sanders later tweeted an apology for the error.

“Jobs numbers for Pres Trump and Pres Obama were correct, but the time frame for Pres Obama wasn’t,” she tweeted. “I’m sorry for the mistake, but no apologies for the 700,000 jobs for African Americans created under President Trump.”