OSAKA, Japan — President Trump was nearly 7,000 miles from home and had just finished a packed schedule of meetings with world leaders. But he still kept an eye on the Democratic presidential contest back home.

At a news conference in Osaka, Japan on Saturday, at the end of the Group of 20 summit, Mr. Trump provided his analysis of a heated exchange between Senator Kamala Harris of California and former Vice President Joseph R. Biden Jr. during the Democratic presidential debates on Thursday, declaring that Ms. Harris had been given “too much credit” for challenging Mr. Biden.

He also lashed out at a former president, Jimmy Carter, who had questioned the legitimacy of Mr. Trump’s 2016 victory by saying Mr. Trump “didn’t actually win” the 2016 presidential election. Mr. Trump proclaimed Mr. Carter “a terrible president.”

And he warned that Democratic policies would bring economic disaster to the United States if he is defeated in next year’s election.