WASHINGTON — After publicly flirting last week with having the United States rejoin the Trans-Pacific Partnership, President Trump appeared to rebuff the idea once and for all late Tuesday.

In a Twitter post at 10:49 p.m., Mr. Trump said that although Japan and South Korea would like the United States to join the 11 other nations in the multilateral trade agreement, he had no intention of doing so. The decision put an apparent end to a meandering trade policy in which Mr. Trump pulled out of the deal in his first week in office, before suggesting last week that he was having second thoughts.

“Too many contingencies and no way to get out if it doesn’t work,” Mr. Trump wrote from his Mar-a-Lago club in Florida. “Bilateral deals are far more efficient, profitable and better for OUR workers.”

The comments confounded some trade experts on Tuesday night because South Korea is not in the Trans-Pacific Partnership.