ELKHART, Ind. — President Obama on Wednesday forcefully inserted himself into the 2016 presidential campaign, assailing Donald J. Trump and the Republican Party for peddling economic policies that he said would benefit the rich and connected at the expense of a still-struggling middle class.

Mr. Obama framed this year’s presidential contest as a choice between a Democratic Party committed to working families and a Republican Party he said was beholden to China, “big oil,” “big banks” and the wealthiest Americans. White House aides cast the speech as the president’s first major attempt to influence the race to succeed him.

“If what you care about in this election is your pocketbook; if what you’re concerned about is who will look out for the interests of working people and grow the middle class,” Mr. Obama said in a fiery, campaignlike speech, “if what you’re concerned about is the economy, then the debate is not even close.”

Aides said the president, who is expected to ultimately endorse Hillary Clinton, was eager to jump into the carnival-like political debate between Mr. Trump, the presumptive G.O.P. nominee, and the Democrats’ choice.