In a hectic weekend of statement and counter-statement, the governments of Ayatollah Ruhollah Khomeini and President Carter were directing their words of diplomacy at their own domestic political audiences, as well as at each other.

In Iran, parliamentary elections are under way that will decide which revolutionary faction will rule the country.

In the United States, presidential primary elections are in progress, with Wisconsin and Kansas voting today.

And in both countries, the handling of the fate of the American hostages could have a major effect on the outcome of the struggles for power.

The weekend's diplomacy and politics began on Saturday when, with the leaders of Iran's government apparently pressing to take control of the hostages from the militants holding the U.S. Embassy in Tehran, Khomeini publicized the text of a purported message from Carter. It was highly conciliatory in tone, talking about American "mistakes" and representing Carter as saying he could "very well understand" how the embassy takeover could have "appeared to you as the understandable reaction of Iranian youth."

It was the sort of wording that Iranian Foreign Minister Sadegh Ghotbzadeh would later characterize as having "created a deblocking of a psychological mood here" by promoting an "extremely favorable" reaction among the Iranian public.

But Carter had made no such conciliatory statements, according to White House officials. To them it was important to set the matter straight -- and today's primaries made it all the more imperative that the correction be handled forcefully and promptly.

Presidential press secretary Jody Powell told reporters at the White House on Saturday that "the president has sent no message to Khomeini -- period." When pressed as to whether "a message" was sent to any other Iranian official, Powell said: "I can say that the president sent no such message to Khomeini or anyone else."

This firm denial was quickly disseminated throughout the country. But about the time that people in Wisconsin and elsewhere were learning of it, Swiss officials were telling reporters that there had been some written messages in the past week from Carter to Iranian President Abol Hassan Bani-Sadr. And the controversy over whether Carter had been apologetic in tone began anew, with Powell's original explanation seemingly discredited.

On Sunday, Powell was in Wisconsin, where he held a news conference on behalf of the Carter presidential campaign. "The decision for me to go to Wisconsin was up to the campaign [officials]," Powell said. "They just felt we had no one there to make news locally."

The news Powell made in Wisconsin was mainly to explain the question of the messages. He was not denying that messages had been sent through the Swiss to the Iranian government. But he repeatedly pointed out that he had said that there were "no such messages." His unstated meaning was that there had been recent messages but none containing the highly conciliatory, even apologetic, language that the Iranians claimed Carter had used. Powell added that perhaps the situation would become clearer in the next day or two.

Back at the White House, the president invited representatives of several major newspapers, including The Washington Post, to meet with him to discuss the matter, in a session that was designated as off-the-record at the time. That the session occurred has since been reported publicly. Yesterday, the president talked with television network representatives about the Iranian situation.

There was understandable concern that the matter not be misunderstood. There had been messages sent through the Swiss, and through private channels, as has been reported. American officials now believe that the Iranian officials embellished the wording to suit their political needs.

But one knowledgeable U.S. official conceded that Powell, in his anxiousness to firmly deny for the American public any hint of an apologetic tone, had not handled the matter as well as he might have.

"Jody knows that," the official said, "and he feels badly about it."