When President Biden welcomes Japan’s prime minister, Fumio Kishida, to Washington this week for a visit highlighted by the pomp of a state dinner, there will be an inescapable subtext to all the ceremony: Both leaders are in a fight to keep their jobs.

With Mr. Biden facing a tight re-election contest with his predecessor and Mr. Kishida’s approval ratings falling to record lows amid a political scandal, the leaders are expected to discuss ways to entrench their countries’ alliance so it remains strong even if they are no longer around to nurture it.

The goal is to “create a situation where no one can unbind their ties,” said Narushige Michishita, a professor of international relations at the National Graduate Institute for Policy Studies in Tokyo.

The risk of drastic change appears to be much higher on the American side. Japanese officials, lawmakers and media outlets have taken to referring to “moshi Tora” — “if Trump” — or even “hobo Tora,” which roughly translates to “probably Trump,” using an abbreviation of the name of the former president and current Republican candidate.

Given Donald J. Trump’s unpredictable behavior and his transactional view of international alliances, Japanese officials are bracing for possible swings in American foreign policy.

On the Japanese side, even if Mr. Kishida does not survive a leadership election this fall in his own party, it will still control the government at least until the next general election and probably beyond that — meaning any big changes in Tokyo’s policy commitments are unlikely.

At the summit this week, during which Mr. Kishida will also address a joint session of Congress, the leaders are expected to talk about closer military cooperation between U.S. forces based in Japan and their Japanese counterparts; collaborations on artificial intelligence, space technology and semiconductors; and the potential for Japan to make and export more weapons to the United States.

The military cooperation in particular “smells of future proofing,” said Tobias Harris, founder and principal of Japan Foresight, a political risk advisory firm in Washington.

During the Trump presidency, the relationship between the two countries withstood some turbulence as Shinzo Abe, Japan’s prime minister at the time, went to great lengths to court Mr. Trump’s favor.

Mr. Biden has worked with two Japanese leaders — Yoshihide Suga, the successor to Mr. Abe, who was assassinated in 2022, and Mr. Kishida — to restore and expand the alliance while also developing stronger bonds with other partners in Asia to counter China’s rising power.

Last summer, Mr. Biden hosted Mr. Kishida and his South Korean counterpart, Yoon Suk Yeol, at the president’s first meeting with foreign leaders at Camp David. This week, Mr. Biden and Mr. Kishida will meet with President Ferdinand Marcos Jr. of the Philippines in the first trilateral session among leaders of those three countries.

In an interview with foreign media outlets on Friday, Mr. Kishida said high-level talks between multiple partners were crucial given the “very complex and challenging security environment.”

“Japan believes that it is important for peace and stability in the region to cooperate with the Philippines and other like-minded countries while maintaining the Japan-U.S. alliance as a cornerstone,” Mr. Kishida said.

China, which has militarized islands in the South China Sea, clashed repeatedly with Philippine boats and pursued a strategy of squeezing Taiwan, has stopped short of a major confrontation that could draw in the United States and, by extension, Japan.

Mr. Biden hopes to consolidate a binding network of Pacific countries to deter Chinese aggression at a time when the United States is already entangled with wars in Ukraine and Gaza.

“The U.S. is obviously running thin in resources and diplomatic capital,” said Mireya Solís, author of “Japan’s Quiet Leadership: Reshaping the Indo-Pacific.” “There is a desire to make sure that the alliance is fit for purpose” if there is a conflict in Asia.

For its part, Japan has made bold changes in defense policy after years of nominal pacifism, doubling the amount earmarked for military spending and acquiring Tomahawk missiles from the United States.

Late last year, Japan shifted postwar policies that restricted the export of weapons and agreed to sell American-designed Patriot missiles made in Japan to the U.S. government.

This week in Washington, Mr. Biden and Mr. Kishida are expected to discuss the formation of a joint defense council that would explore further exports, including additional Japanese-produced Patriots, cruise missiles and trainer jets used by fighter pilots, according to a senior American government official who requested anonymity to speak about details of the meeting. Japan could also cooperate with the United States to help repair American Navy ships so they do not have to leave the region for maintenance.

Beyond defense, an economic component to Mr. Kishida’s visit — an expected trip to a Toyota battery plant for electric vehicles in North Carolina — may also be intended to offer a public reminder of Japan’s investments in the United States.

Such reminders may be aimed particularly at Mr. Trump: In 2019, during a Group of 20 summit in Osaka, Japan, Mr. Abe gave the president a one-page, colorful map that showed American investments by companies based in Japan, the largest foreign direct investor in the United States.

Without explicitly mentioning it, Japan may also be trying to exert pressure on the Biden administration to allow Nippon Steel, a Japanese corporation, to acquire U.S. Steel, the struggling manufacturer based in Pittsburgh.

“The contrast between an administration raising national security concerns about a Japanese steel company buying an American steel company at the same time you’re trying to raise military industrial cooperation — the messaging is a little messy,” said Mr. Harris, the Japan analyst.

If the deal does not go through, it could complicate business ties between the two countries, said Wendy Cutler, vice president of the Asia Society Policy Institute and a former U.S. trade representative in Asia.

“The question is whether going forward this leaves a chilling effect in the eyes of other Japanese investors or, frankly, investors from other allies and partners,” Ms. Cutler said.

Rahm Emanuel, the U.S. ambassador to Japan, said the alliance between the two countries “runs a lot deeper and is a lot stronger and has a lot more strategic alignment than a single commercial deal.”

With Congress stalled over extending American military assistance to Ukraine, Mr. Kishida’s aides declined to say whether the prime minister would invoke Japan’s support for Ukraine during his speech to American lawmakers this week.

But in the interview on Friday, Mr. Kishida said he would like to “express and acknowledge with President Biden the importance of continued efforts to achieve a just and lasting peace in Ukraine through unity among the G7 and other like-minded countries.”

As for the ceremonial parts of the visit, no word yet on whether the prime minister will follow his South Korean counterpart by crooning an iconic American song at the state dinner on Wednesday.

Kiuko Notoya contributed reporting.