LIMA, Ohio — President Trump, in a speech largely crediting himself for the strong economy, told plant workers here Wednesday that his future 2020 Democratic opponent will struggle in debates because he will just rattle off unemployment statistics.

“So it’s going to be really easy on the debate stage when they hit me with nonsense and I say, ‘Really, but African American employment, the best it has ever been. Hispanic, Asian, women, everybody, it’s all the best it has ever been.’ How do you top that in a debate? What are they going to say? Well, it could be better?” Trump said.

That was as close as he got to talking politics. Trump then spent the better part of his 50-minute speech focused on economic issues, sticking to the kind of positive message that Republicans were desperate for him to lean on during the 2018 midterm elections.

Trump did go negative at some points, however, including five minutes at the start of his speech disparaging the late senator John McCain. He railed against the media and said former president Barack Obama and “Crooked Hillary” could not have achieved what he has. He even made fun of Michael Dukakis, who famously posed inside a tank for a picture when he was the Democratic nominee for president in 1988, an image that looked so foolish that some say it cost him the election. During a tour of the plant, which manufactures tanks, Trump turned down an offer to get in one because of Dukakis.

“I remember he tanked when he got into the tank. He tanked and I never saw anybody tank like that,” Trump said. So I said maybe . . . but I'm a little bigger than him. I think it probably would work out okay. How would I look in a tank? Okay?”

Trump’s visit to the Joint Systems Manufacturing Center in Lima, which is operated by General Dynamics, was an official White House event and not one of his more freewheeling “Make America Great Again” rallies. Still, Trump did spend five minutes at the start of his speech disparaging the late senator John McCain and later said former president Barack Obama and “Crooked Hillary” could not have achieved what he has.

The trip here marks his 10th visit to Ohio since becoming president. A senior administration official said in a conference call with reporters Tuesday night that the president’s repeat trips to the state are a sign of his priorities.

Trump won Ohio in the 2016 presidential election, and the swing state is expected to be critical to his keeping his job in 2020, as well.

The Lima plant produces Abrams tanks, the U.S. Army’s main battle tank. The Trump administration steered funding to the plant in 2017, so the president asserted several times in his speech on Wednesday that without him the plant would be closed.

“You better love me. I kept this place open, that I can tell you. They said, ‘We’re closing it.’ And I said, ‘No, we’re not.’ And now, you’re doing record business,” Trump said when he came onstage to chants of “USA, USA.”

Trump campaigned for president on the promise of bringing manufacturing jobs back to the United States. Yet, roughly three hours east of Lima, and an hour northeast of Canton, Ohio — where Trump is set to speak at a private fundraiser Wednesday evening — is Lordstown, Ohio, home of the auto manufacturing plant that General Motors announced last fall it was shuttering.

The Lordstown plant is not the only one that GM has closed or scaled back in recent months, and Trump’s struggles with the auto industry have undercut his message of economic prosperity — and a resurgence of manufacturing jobs, in particular.

Over the weekend and into Monday, Trump publicly lashed out at the company and said he had spoken with chief executive Mary Barra.

“I am not happy that is closed when everything else in our Country is BOOMING,” Trump wrote on Twitter. “I asked her to sell it or do something quickly.”

He added that Barra had blamed the United Auto Workers union. “I don’t care,” he wrote. “I just want it open.”

In another tweet, he cast the automaker’s problems as an aberration in the successful economy. “Because the economy is so good, General Motors must get their Lordstown, Ohio, plant open, maybe in a different form or with a new owner, FAST!” Trump wrote.

Trump also slammed the local UAW president by name in a tweet over the weekend, writing, “Democrat UAW Local 1112 President David Green ought to get his act together and produce. G.M. let our Country down, but other much better car companies are coming into the U.S. in droves. I want action on Lordstown fast. Stop complaining and get the job done! 3.8% Unemployment!”

Democratic presidential candidate Beto O’Rourke seized on the moment, live-streaming on Facebook a conversation with Green on Monday in a direct rebuke of the president.

Trump continued his criticism of GM and union leaders generally during the Wednesday speech, telling the crowd that while union workers are great, union leaders are dishonest because they praise him privately but then support Democrats.

Trump also told the workers that the union “ought to lower your dues, by the way. You’re paying too much.”

Kellie Gormly contributed to this report.