An Italian magistrate formally indicted three Bulgarian officials and five Turks today in connection with the attempted assassination of Pope John Paul II and said he had evidence that a second gunman had fired a shot at the Polish-born pontiff.

The indictments conclude a three-year investigation by Italian judicial authorities into allegations of an international conspiracy to murder the spiritual leader of the world's 800 million Roman Catholics. Initially, convicted papal assailant Mehmet Ali Agca, 26, claimed that he had acted entirely alone in shooting the pope in St. Peter's Square in Rome on May 13, 1981.

"We can be certain that there was a plot to kill the pope," examining magistrate Ilario Martella told a news conference after formally depositing a 1,243-page indictment in a Rome court. He added that no date for a new trial has been set yet.

While insisting that there was sufficient circumstantial evidence to justify bringing the Bulgarians to trial, Martella refused to speculate in his public comments today about whether the Soviet Union had been behind the assassination attempt. When asked if he shared the opinion expressed in an earlier report by a public prosecutor that the attack was a Soviet Bloc conspiracy designed to suppress the independent Solidarity trade union in Poland, he said: "I have stuck to the facts."

He later told a reporter for the authoritative Italian daily Corriere della Sera that he had not attributed responsibility for the papal plot to "any government or any nation because I am not in possession of objective evidence that would allow me to formulate such an accusation."

The full text of Martella's report has not been released yet.

The decision to indict Sergei I. Antonov, 36, and two other Bulgarian officials was sharply attacked in both Moscow and Sofia. Declaring that the former airline employe was "absolutely innocent," the official Soviet news agency Tass said that the only accusations against him had been made by Agca.

In its first reaction, the official Bulgarian news agency BTA accused "certain circles" in the Italian government of conducting "a vile antisocialist campaign" and questioned the "objectivity and impartiality" of the Italian justice system.

In Washington, State Department spokesman John Hughes praised the Italian investigation as "determined and conscientious" but said the United States would not comment on the charges until the Italian courts had reached a verdict.

The formal indictments against Agca's alleged Bulgarian and Turkish accomplices were widely expected after the Italian public prosecutor filed a report earlier this year depicting the assassination attempt as part of a Soviet Bloc conspiracy.

The surprise in the indictment was Martella's conclusion that more than one gunman had fired at the pontiff.

Martella identified the second gunman as Oral Celik, a suspected member of a right-wing Turkish terrorist group known as the Gray Wolves, who allegedly escaped from St. Peter's Square in the confusion that followed the unsuccessful assassination attempt. Celik, 25, has been in hiding ever since.

Until now, investigators had spoken of just two shots being fired at the pontiff. Martella said, however, that eyewitness testimony, film of the assassination attempt and an examination of the likely trajectory of the bullets indicated that a third shot must have been fired by someone standing close to Agca.

The third bullet, according to Martella, hit the pope in the index finger of his left hand before grazing his left forearm. It has not been found.

Martella said he concluded that the second papal assailant was Celik on the basis of Agca's testimony, a photograph taken by an American tourist moments after the assassination attempt and a long history of contacts between the two Turks.

According to two brief sections of the indictment released by Italian magistrates, Antonov was waiting with a car near the square to help both Agca and Celik escape. The escape plan allegedly went wrong after Celik failed to set off two bombs that he was carrying to create panic.

Antonov, former Rome manager of the Bulgarian state airline Balkanair, was arrested in November 1982 and is the only one of the three indicted Bulgarian officials who will appear in court in Italy. The other accused Bulgarians, both formerly stationed at the Bulgarian Embassy in Rome, are in Sofia.

Martella said the state's case against the Bulgarians was based on Agca's own testimony and the fact that the pope's would-be assassin had been able to provide investigators with numerous accurate details of their physical characteristics, movements and personal habits. He added that all three men had denied ever meeting Agca.

Asked whether it had been possible to find independent witnesses willing to testify to meetings between Agca and the Bulgarians, he replied: "That would be too beautiful."

The judge added that alibis produced by the indicted Bulgarians for the day of the assassination attempt were "inconsistent" and had been contradicted by other witnesses. He did not elaborate. Antonov has claimed that he heard the news of the pope's shooting in the Rome office of Balkanair.

The following is a full list of those indicted today:

*Mehmet Ali Agca. Arrested seconds after he fired two shots at the pope and convicted of attempted murder in July 1981, Agca will go on trial again on the lesser charge of smuggling the murder weapon into Italy.

*Sergei I. Antonov. Arrested on Nov. 25, 1982, after being identified by Agca from a photo album as one of his alleged accomplices, he is now under house arrest in Rome.

*Todor S. Aivazov, 40, former administrative officer at the Bulgarian Embassy in Rome. Agca told magistrates that he met Aivazov in Sofia in July 1980 under the code name "Sotir Kolev" and held initial discussions with him about a possible project to kill the pope. Aivazov returned to Sofia in November 1982.

*Zhelio K. Vasilev, 42, former assistant military attache at the Bulgarian Embassy in Rome. Agca depicted Vasilev (code-named "Petrov") as his chief Bulgarian control officer in Italy. Vasilev returned to Sofia in August 1982.

*Bekir Celenk, 49, a Turkish businessman already indicted on charges of smuggling arms through Bulgaria. Agca alleged that he and his Turkish accomplices were offered 3 million West German marks (then about $1.2 million) by Celenk to kill the pope. Celenk now lives in Bulgaria under police supervision.

*Musa Serdar Celebi, 32, leader of an offshoot of the Gray Wolves in West Germany. His organization allegedly provided logistical support to Agca and Celik during the months leading up to the papal assassination attempt. Celebi is under arrest in Rome following extradition from West Germany.

*Omer Bagci, 28, has admitted hiding the gun with which Agca shot the pope and delivering it to him in Italy. Bagci is under arrest in Rome following extradition from Switzerland.

*Oral Celik, 25, a Gray Wolf from Agca's hometown of Malatya in eastern Turkey. Also wanted in Turkey in connection with the murder of a liberal newspaper editor in February 1979, Abdi Ipekci, Celik allegedly helped Agca escape from a top security prison in Istanbul in November 1979.

The formal indictment added that at least five other persons who had so far not been identified were also involved in the plot. Questioned on this passage in his report, Martella said that the unidentified coconspirators could include both Bulgarians and Turks.

At the news conference, Martella said that all charges arising from Agca's description of a plot to kill Polish Solidarity leader Lech Walesa were being dropped. Agca later retracted some details of this episode and was formally warned that he would be investigated for slander.

The slander charge has now been withdrawn "for lack of evidence" on the ground that it cannot be proved that Agca's original version was incorrect.

Noting that the forthcoming trial would be based largely on circumstantial evidence, Martella said that it would be up to the court to establish "whether the results of the investigation are such as to determine the guilt or innocence" of those indicted.

Urging caution in drawing political conclusions from the inquiry, he said: "There are some elements that are more or less certain from the point of view of proof while others still have to be verified. It will be up to the court to decide."

In a new development in the case that sheds light on the early background of the pope's would-be assassin, government officials in Turkey announced this week that a policeman and six customs officials had been arrested for helping Agca cross the border to Bulgaria following his escape from prison.

Mesut Yilmaz, the Turkish government spokesman, told parliament in Ankara that a police investigation had uncovered links between a large smuggling ring and Agca.

In testimony to both Turkish and Italian magistrates, Agca has alleged that he was protected by members of a smuggling ring known as the "Turkish mafia" in both Turkey and Bulgaria.