He assailed The Times. “I called for the resignation of everybody at The New York Times involved in this,” he said. “They have taken the old Gray Lady and broken her down, destroyed her virtue and ruined her reputation.”

Mr. Trump’s visit to New Mexico was his first since becoming president, and he vowed to make it competitive next year. “We are here because we really think we’re going to turn a state and make it a Republican state,” he said.

In his build-the-wall fervor, Mr. Trump has repeatedly used racially inflammatory language. He opened his presidential campaign in 2015 by denouncing Mexican “rapists” coming across the border (although, he said, some immigrants “I assume are good people”) and later claimed an American-born judge could not fairly handle a lawsuit against him because he was “Mexican.” The president has also denounced caravans of migrants heading for the border as “invaders” and gang members as “animals.”

But Mr. Trump and his allies maintain that his tough words apply only to criminals or bad actors, not to Hispanics as a whole. Hispanics whose families came to the United States legally, they argue, do not approve of others breaking the law to enter the country. And they add that many Hispanics share Mr. Trump’s views on regulation, taxes and social issues.

In his speech on Monday night, Mr. Trump rejected the accusation that his policies and language played to racial stereotypes and promoted animosity. “I’m the least racist person in this room,” he said.

“We are working night and day to deliver a future of limitless opportunities for our nation’s Hispanic-American citizens,” he said, “including millions and millions of extraordinary Mexican-Americans who enrich our society, and strengthen our country, serve in our military, and contribute immensely to other shared American family.”

New Mexico Democrats, who held a unity and diversity rally to counter Mr. Trump, argued that the president was actually harming the people he said he was helping, noting that he had diverted money from military construction projects to finance his border wall without permission from Congress, including an unmanned aerial training facility at Holloman Air Force Base.