Polish Prime Minister Gen. Wojciech Jaruzelski said today his government is investigating allegations that a Polish diplomat was involved in India's widening espionage scandal, but he denied that Poland was interested in obtaining any state secrets.

In a press conference following two days of talks with Indian Prime Minister Rajiv Gandhi and other Indian leaders, Jaruzelski said that "anything of interest to us in India can be acquired by us legally," and that "we have no need to resort to other methods or ways of collection."

Revealing traces of annoyance at repeated questions about the spy case, the Polish leader told reporters at one point, "I'm very sorry but I cannot satisfy any demands for sensationalism, and I have nothing to add to that question."

Jaruzelski's visit to India is his first outside the Soviet Bloc since he assumed leadership of the Polish government in 1981, and his remarks followed disclosures that Gandhi raised the espionage issue during a two-hour meeting on Monday.

In an unusual public reference to such an embarrassing topic during a state visit, an Indian Foreign Affairs Ministry spokesman yesterday said that "the Indian prime minister drew the attention of the prime minister of Poland to this matter."

The Indian government has refused to discuss details of the alleged involvement of Polish officials in the spy ring, but the Press Trust of India news agency reported that New Delhi businessman Kumar Narayan, allegedly a central figure in the espionage case, declared in a written confession submitted in court that he sold defense secrets to a deputy commercial attache in the Polish Embassy here. The Polish official, identified in Indian press reports as Jan Haberka, reportedly returned to Warsaw last August after serving here for more than four years.

So far, 16 Indian government officials and businessmen have been arrested, and eight have made statements in court implicating diplomats from France, Poland, the Soviet Union and East Germany in buying state secrets stolen by office assistants and secretaries in the prime minister's office, the president's office and the Defense Ministry over a period of 25 years.

Two junior diplomats have reportedly been recalled from the Soviet and East German embassy staffs, and official sources said that a second Soviet official may be asked to leave. Most of the secret documents said to have been stolen and copied by low-ranking Indian government employes reportedly dealt with defense procurement contracts.

Although France has come under increasing public censure following the hurried departure of its deputy military attache, Alain Bolley, the Eastern European link has particularly unsettled Indian officials, who have long relied on the Soviet Union for financial assistance. Moscow provides India with about 75 percent of its arms imports, and the espionage ring was believed to have centered on India's efforts recently to diversify it military purchases into western markets.

Jaruzelski, in an hour-long press conference, said he had assured the Indian prime minister that "we shall do our best to investigate the matter very closely to find out whether a Polish diplomat or an employe of the trade mission could have exceeded his functions."

When Indian reporters repeatedly returned to the question, the Polish leader expressed impatience, saying, "The reply I have given on this particular subject I deem as exhausted . . . ."

When asked whether the conviction of four security officers in the murder of pro-Solidarity priest Jerzy Popieluszko meant that the case was closed, or whether additional conspirators would be arrested, Jaruzelski replied that Polish justice had run its course in an open trial, and that "so far it has been impossible to find any other inspiration or complicity except on the benches where the accused were sitting."

He added, "Should we find in the future any other traces of instigation, it would be in the best possible interest of Poland" to prosecute. But, Jaruzelski said, "for the time being there are no such traces."