If you’re trying to make sense out of the NAFTA negotiations, where Canada is suddenly rushing to avoid being shut out of a US-Mexico deal, consider this: With his insufferable moral arrogance, Canadian Prime Minister Justin Trudeau has been cruising for a bruising — and now he’s gotten it.

Given Trudeau’s attempt to reinvent the country as the smarmy Eddie Haskell of nations, it’s been fun to watch — but let’s make sure it doesn’t end up costing both Canada and the United States.

Trudeau’s first rude awakening, by the way, didn’t come at the hands of Team Trump. Justin had become a laughingstock when visiting India last February, where he dressed the family Bollywood-style. Even the Indians thought he was a joke.

More serious was his next reality check, via the Saudis. The Canadian foreign ministry had tweeted that Saudi Arabia should release women’s-rights activists, and the Saudis responded by closing their embassy, ordering Saudi students to return home and freezing all trade ties. Diplomatically, that’s going rogue.

Remarkably, the US refused to take sides. Our State Department simply asked both parties to work it out.

Then came Trump’s rebuff of Trudeau over the NAFTA talks. The Canadians had assumed they were in the driver’s seat, and presented a set of initial demands that were guaranteed to infuriate Trump. They wanted gender equality and native rights to be on the table, and suggested that right-to-work laws were an unfair trade practice.

They took their time bargaining, and let the Mexicans know that they’d look after them. They knew Trump had problems with Mexico and told Mexican President Enrique Peña Nieto they’d stick up for him.

Except that Justin had gone out of his way to annoy Trump. When the G-7 assembled in Quebec last June, Trudeau prepared the wokiest of politically correct topics to discuss, and showed he was peeved when Trump turned up late at a session.

It all came undone over the last two weeks. First, the Mexicans, to whom the Canadians had condescended, showed that they didn’t need Trudeau’s help and cut a deal with Trump that excluded Canada. Of course we want Canada to be included in NAFTA, they said. But you have to understand that, for us, Mexico comes first and we need a trade deal with the US.

So much for the three amigos.

After the deal with Mexico was announced, Canadian Foreign Minister Chrystia Freeland cut short a European visit to come to Washington and negotiate with the US trade representative. While the talks were ongoing, the Toronto Star revealed that Trump had said off the record that the United States wasn’t going to bend on any item. If they had problems with that, he said he had an easy answer. He’d show them a picture of the Chevy Impala, which is made in Oshawa, Ontario, and shipped to the US duty-free under NAFTA.

If NAFTA goes down, Canada will be the big loser, especially in its auto industry, where 120,000 Canadian jobs are at stake. But we also would be losers. The auto industry has suppliers on both sides of the border and just-in-time production methods would put thousands of Americans immediately out of work if Detroit’s Ambassador Bridge were shut down for a few days. As it is, more US trade crosses over that bridge than our entire trade with Japan.

Trump worries about trade deficits, but we’re running a trade surplus in goods and service with Canada, and it’s one of the very few countries of which that can be said. It’s the most important trading partner for 35 states, and as many as 9 million US jobs depend on trade with Canada.

It’s not as if there will be much daylight between the two countries, when trade negotiations begin on Wednesday. We’re not happy with Canada’s supply-management system, which subsidizes eggs and milk products — and that’s something the Canadians should be happy to give up, since it costs the average Canadian family $150 a year.

The Canadians also want a dispute-resolution mechanism, which could prove an advantage to the US as well as Canada. Everybody cheats, and it wouldn’t hurt to have neutral parties work things out.

So both sides should be able to compromise and get to yes. Given the two leaders’ personalities, it’s easy to see how the Canada-US deal could fall apart. Let’s hope it doesn’t.

F.H. Buckley is the author of the new book “The Republican Workers Party: How the Trump Victory Drove Everyone Crazy, and Why It Was Just What We Needed.”