If he ever got out of Iran alive, Moorhead C. Kennedy Jr. used to tell himself those 14 months he was a hostage, he had to make Americans realize what it was that put him and the others there in the first place.

"I came out of captivity having thought over all the things I wanted to do . . . One of the many thoughts was that we were the victims of the tremendous force that religion is in countries like Iran."

Yesterday, Kennedy announced that he is leaving the State Department later this summer to become director of the Cathedral Peace Institute, a new think tank connected with the Episcopal Cathedral of St. John the Divine in New York City that will attempt to define and investigate the religious dimensions of international affairs.

"Religion as a force" is something the State Department does not attempt to delineate to any extent for policymakers or its Foreign Service officers, though U.S. credibility abroad would be better served if it did, Kennedy said in an interview earlier this week.

He said the reason the Iranian students were so hard to deal with was that, besides being badly educated and learning everything by rote, "part of their background is religious and the Koran was handed down just as God wrote it through Mohammed, and certain truths are not subject to interpretation, so their minds are closed.

"They continued to tell us the that 'he who understands Islam has the truth.' Well, that ties in with literalism and produces a pretty terrifying mentality."

Kennedy said he doubted that American officials "ever sat down and thought as hard as they should have about what forms these people, of which religion is one element . . . I think we are much more parochial in our view than we want to admit."

As he talked of the need for the center, he added: "Oh sure you talk about a church as a political force where you talk about a political party. But there is a tendency to look the other way when people start talking about religion. People get a little hung up about it, and it doesn't figure into our thinking as objectively as it should. I think we feel about religion the way Victorians felt about sex -- it may be there, but you don't talk about it."

He called it an "exaggerated idea of what the First Amendment prohibits" when in fact, as a nation, "we're very ambivalent. We have chaplains in military service, in the U.S. House and Senate, and at inaugurations a number of divines stand up. It's reached a point where we have to take a more natural view of it, crank it into our foreign policy as a reality.

All this started to sink in while Kennedy, 50, the economics counselor at the Tehran embassy when it was seized, waited out his 444 days of captivity and thought about a lot of things -- "You had a lot of time to think about a lot of things." Among them was how unprepared Americans had been for the revolution in Iran, how they had had no idea what Ayatollah Khomeini was trying to say.

"We were victims of a lack of sensitivity to the tremendous force that religion is in Third World countries, particularly in countries like Iran which have been forced into a modernization program for which they are not ready."

The Khomeini revolution, in a sense the result of rising oil prices and all the Westernization that money could buy, produced a religious revival back to basic Islamic and traditional Iranian values.

"You have people whose way of life has been threatened, if only because they're moving in from the villages to some industrial site in Tehran. The skills they bring are not vary relevant, the manner of doing things which they see on television is Western and doesn't conform to their basic value system. They find their young acting in ways they do not approve of. So you get a religious revival."

Another thought occurring to him, he said, was the irony of the image America was projecting abroad: that of a godless, completely hedonistic society without morals or standards of behavior when, in fact, it is far more traditional and has been going through a religious revival of its own.

"I think the hostage crisis sent an awful lot of people back to church, or at least set them wondering in a way they hadn't perhaps wondered before. I think the Moral Majority was one symptom of this, though there is a lot more to this than just the Moral Majority," he said, sitting with his wife, Louisa, in an office the Johns Hopkins School of Advanced International Studies has put at their disposal while they collaborate on a book.

At Princeton University where he was in Oriental studies, his special field had been Byzantine theology and, after wrestling with various controversies, he convinced himself, he said, that the Christian faith probably was corrent as far as it went. But it wasn't part of his life. He did not join the church until years later when the Foreign Service sent him to Chile.

In Santiago he worked with a slum relief project sponsored by his church. When a description of that work was included in his State Department efficiency report, he said, a review panel later insisted the word "church" be deleted.

Just recently, when he told superiors in the Foreign Service that he planned to retire and work with the new institute, Kennedy said someone asked if he was sure he wouldn't rather take a leave of absence. Someone else, however, told him, "You might have a problem working for a religious organization. I'm not sure that under the First Amendment we could release a Foreign Service officer to go work for a church."

Kennedy said that for the center's work to be good or useful, it will have to get away from a kind of "ivory tower of people taking in each other's laundry. We can all think of foundations where this kind of thing goes on and nothing ever flows from it. Our emphasis has to be activist and visible."

He thinks that rather than take a direct or shrill position, the center should try to inform Americans about such things as what the possibilities of peace are in El Salvador and what role the church there could play, what the underlying causes are of dissatisfaction there and why rebels have the support they have.

"If we [the center] can keep lines open into the Foreign Service, the military, the Central Intelligence Agency, commerce and others who get involved in our foreign affairs, something is bound to happen. Not overnight, maybe; but if we can raise the level of consciousness a little bit, we'll have done a lot," Kennedy said.

Kennedy and invited international experts will get their information out through seminars and workshops as well as a future newsletter and eventually perhaps even a magazine, he explained.

At a New York press conference yesterday, the Very Rev.James P. Morton, dean of the cathedral, also announced that the Kennedys will co-chair a $35 million capital fund-raising drive for the cathedral, with former secretary of state Cyrus R. Vance and his wife, Grace, serving as honorary co-chairs.