Japanese public prosecutors today asked a Tokyo district court to impose a maximum five-year prison sentence against former prime minister Kakuei Tanaka for his role in the long-running Lockheed bribery scandal in a landmark political event that threatened to rattle the foundations of Prime Minister Yasuhiro Nakasone's Liberal Democratic Party.

Tanaka, the party's leading power broker and a key Nakasone supporter, is accused of accepting a $2.1 million bribe for allegedly influencing the sales in Japan of Lockheed TriStar passenger jets. Today's development in the seven-year-old court battle was interpreted here as a blow to Tanaka's political fortunes and a setback to Prime Minister Nakasone who came to power with the crucial backing of Tanaka's faction in the ruling party.It set the stage for a final ruling in the case sometime later this year.

In a marathon court session today, public prosecutors presented their final arguments by reading a 560-page document accusing Tanaka, 64, of accepting the bribe from Lockheed agents in Japan when serving as prime minister in 1972.

Through a battery of defense lawyers Tanaka has repeatedly denied the charges, which include alleged violations of Japanese foreign exchange laws. Under Japan's complex legal system, prosecutors today demanded that Tanaka be given a maximum prison term of five years and pay a fine of about $21,000.

The dramatic move came amid intense coverage by the Japanese press and touched off a public outcry calling on Tanaka to resign his seat in the Diet, or parliament. The protest was led by the country's opposition political parties who have long criticized Tanaka's shadowy role as kingmaker in the party that has governed Japan for the past 28 years.

An estimated 20,000 protesters chanting slogans and carrying paper lanterns marked "Arrest Kakuei" marched through Tokyo streets near the ex-premier's residential compound this evening demanding that he bow out of national affairs.

Tanaka's trial began in January 1977 following U.S. Senate subcommittee hearings that had brought the Lockheed payoffs to light the previous year. During most of the lengthy court proceedings, the controversy swirling around Tanaka appeared to do little if any damage to his political power. Today, he is still the dominant figure among Liberal Democrats even though he was forced to give up official party membership in disgrace following his indictment.

With at least 110 members, the faction of Liberal Democrats that bears Tanaka's name is by far the largest in parliament and gives the former premier power behind the scenes in party politics and legislative affairs. The Tanaka faction was instrumental in the Diet vote that brought Nakasone to office on Nov. 26 and was, in turn, favored by Nakasone with key Cabinet appointments. Nakasone's choice of Tanaka loyalists for top jobs churned up public outrage.

According to political analysts here, the prosecutors' strongly worded case against Tanaka will intensify pressure for him to give up his Diet seat. Prosecutors argued today that the huge sums of money and the high political office involved had "deeply damaged the Japanese people's trust in national politics."

If the Tokyo district court fails to impose stern penalties, they warned, "it might endanger the very roots of democratic politics."

As prosecutors read their six-hour summation, Tanaka appeared bored and restless. They also demanded prison sentences for Tanaka's four codefendents, including a one-year jail term for Toshio Enomoto, 56, Tanaka's former personal secretary. They asked for four years imprisonment for Hiro Hiyama, 73, former chairman of Marubeni Corp., and 30-month sentences each for Hiroshi Ito, 56, and Toshiharu Okubo, 69, both former Marubeni managing directors.

In July 1976, Tanaka was arrested on charges of accapting 500 million yen or about $2.l million from Marubeni, the Japanese trading company that acted as Lockheed's agent in promoting aircraft sales here.

Enomoto was charged with allegedly accepting the money in a series of clandestine meetings with Marubeni officials and delivering it to Tanaka at his home. Throughout the trial, both Tanaka and Enomoto have denied prosecutors' claims that they had taken the money, although the Marubeni executives acknowledged they had paid the bribe.

Tanaka's team of defense attorneys has mustered a battery of witnesses in a bid to prove that Enomoto was otherwise engaged when the payments allegedly were made. The sharpest jolt to that defense came when prosecutors called Enomoto's ex-wife as a surprise witness. She testifed that Enomoto had told her he had accepted the bribes on Tanaka's behalf from Marubeni officials.

Prime Minister Nakasone has threatened to dissolve the Diet, where his party commands a large majority, and call early elections should opposition party protests snowball. Pressed by Japanese reporters today, Nakasone refused to comment on the prosecutors' demands, saying it was not proper for a prime minister to discuss matters pending in the courts.