Italian newspapers published a letter today written in 1983 to a Rome-based U.S. diplomat by Mehmet Ali Agca, Pope John Paul II's would-be assassin, in which the Turkish terrorist implies that U.S. officials played a role in his testimony regarding an alleged Bulgarian-run plot to kill the pope.

The U.S. Embassy here immediately denied that any American official ever had any contact with Agca and said that the embassy was mystified by Agca's references to extensive contacts with a U.S. military attache here and Agca's appeal to the embassy to help him prove his allegations that the late Soviet leader Yuri Andropov instigated the attack on the pope.

In the letter, which was published in full today by the Rome daily La Repubblica, Agca repeats his assertions that the Soviet Union plotted to assassinate the pope and Polish labor leader Lech Walesa as well as Iran's Ayatollah Ruhollah Khomeini and the American hostages in Tehran.

Agca subsequently admitted to Italy's chief investigator in the case, Judge Ilario Martella, that he invented the story about discussing killing Walesa, Khomeini and the hostages with a Soviet diplomat stationed in Iran. This retraction has cast some doubt on Agca's credibility in a case that depends heavily on his testimony.

The authenticity of the letter was confirmed by Martella and by a U.S. Embassy official.

But U.S. Embassy spokesman Joe Johnson denied that U.S. government officials ever had any dealings with Agca, who is serving a life sentence in an Italian prison for shooting the pope in May 1981.

Since Agca began talking to investigators here about what is now known as "the Bulgarian connection," Bulgarian officials and some other observers have speculated that the Turk's testimony may have been instigated by someone with an ax to grind against the Soviet Union and the Eastern Bloc.

But Martella, who indicted three Bulgarians and four Turks last fall as coconspirators in the attack, has ruled out the possibility that any outsiders could have provided Agca with the details of his story.

Johnson confirmed today that a letter, written in Turkish and signed by "someone purporting to be Mehmet Ali Agca," was received in August 1983 by the U.S. military attache at the time, Capt. Ernest Till, and was turned over to Italian investigators.

But he stressed that "U.S. government authorities do not have nor have ever had any dealings with Mr. Agca." He pointed out that Agca has written many letters from jail to Italian, Vatican and Turkish government officials, among others.

When questioned by Martella in 1984, Agca said that the Aug. 5, 1983, letter to Till and an earlier communication he claims to have sent to the U.S. Embassy were "expedients used by me in the hope of having great success with U.S. public opinion" concerning his allegations of Bulgarian involvement in the papal assassination plot.

Agca's letter to the U.S. military attache starts off by implying that an ongoing relationship existed between the two of them. He continues, "For two years you have done everything necessary in view of our mutual friendship and interest. However, given recent developments, I would like to give you a certain number of suggestions . . . ."

The Turkish terrorist then complains about the skepticism toward his story expressed by certain American news organizations. "What crime have I committed?" he asks, adding, "You told me, 'begin' and I began to speak."

The letter, which also contains some suggestions on sharpening the anti-Soviet thrust of U.S. foreign policy, urges the military attache to find Vladimir Kuzintski, a Soviet diplomat stationed in Iran who later defected to Britain.

According to Agca's letter, Kuzintski could provide testimony about Andropov's decision to have both John Paul and Walesa assassinated; about Soviet training of Middle Eastern and European terrorists in the 1970s through Syria, Bulgaria and East Germany, and a plan in April 1980 by Kuzintski, the Iranian Tudeh communist party and Agca to kill Khomeini and the American hostages to force the United States to invade Iran as a means of weakening U.S. standing in the world.

Martella's report, which will provide the basis for the prosecution's case in a trial now expected to begin in April, points out that in January 1984 Agca retracted his story about contacts with Kuzintski.