The death of John Paul I, the smiling pope who had managed to win the hearts of millions in just 34 days as supreme pontiff, has left the Roman Catholic Church in a state of shock and disarray.

As cardinals from all over the world started returning to Rome yesterday - their second such somber trip to the Eternal City in less than two months - a meeting of the Sacred College of Cardinals was set for today to begin discussions of funeral arrangements and preparations for election of a successor.

Thousands of the faithful began filing past the body of John Paul, which lay in state in the Apostolic Palace of the Vatican, just hours after he was found dead in bed in his chambers early yesterday.

Doctors attributed his death, at age 65, to a heart attack, although there was no autopsy and he was not known to have had previous heart problems.

The body of the dead pope was in the traditional scarlet mourning garb with simple red slippers as it lay in state. In John Paul's clapsed hands was a black rosary, and over the hands was a bouquet of nearly black roses.

A pope's body traditionally lies in state for at least three days before the funeral, which will be set by the College of Cardinals. The conclave of 110 cardinals qualified to vote for a new pope must begin its secret deliberations between 15 and 20 days after the pope's death. This means the conclave will begin between Oct. 13 and 18.

"The Smiling Love" was the headline on the front page of the official Vatican newspaper Osservatore Romano, which was bordered in black.

In his 34-day reign, Pope John Paul changed the style of the papacy, stressing human contact and devoting his weekly audiences to chatting with members of the crowd chosen at random, rather than delivering the kind of highly intellectual homilies that his predecessor Paul VI used to deliver during his 15-year papacy.

At his last public audience Wednesday, for example, John Paul picked a fifth-grade boy out of the crowd and engaged him in a dialogue about school.

But the new pope had had insufficient time to indicate a direction to his papacy. At the same audience, the pope made the first public reference to worries about his own health.

"You should know," he said, "that the pope who is addressing you has suffered as you have. He was hospitalized eight times and underwent four operations."

As a youth, he spent a year in a tuberculosis sanatorium. Because of a poorly performed tonsillectomy, he also suffered periodically from laryngitis. But, in later life, he appeared robust, and there had been no public hint of the heart trouble that felled him as he lay in bed Thursday night reading the 15th Century theological classic "The Imitation of Christ" by Thomas a Kempis.

The death of John Paul leaves the church in much the same state it was when Pope Paul died in early August - without an obvious sucessor. The new pope, who was patriarch of Venice when he was elected, was a compromise whose choice was dictated by the determination of a majority of the cardinals that they wanted an Italian but not a member of the Curia, the government of the Vatican.

That narrowed the field of papabili - the Italian word for possible popes - to just a few names, including Albino Cardinal Luciani, the future John Paul.

Although a majority of the college or cardinals is non-Italian for the first time in centuries, an Italian is still favored for a number of reasons:

Tradition.

Italy is not a major power and is seen in church terms to be relatively neutral mong the countries with large Catholic or Christian populations.

With the Italian government engaged in a delicate balancing act between the Communist Party and the ruling Christian Democratic Party, it is not the time for Rome to have a "foreign" pope.

A large proportion of the younger cardinals who represent the underdeveloped countries of the Third World are "Italians" - churchmen whose background, training and loyalties are Italian.

John Paul was generally regarded as a theological conservative, but he had also shown that he was capable of changing his opinion on fundamental points.

He is on record as having changed his stand on the principle of religious liberty after having listened to the debates in the Vatican II council that revised much church thinking in the 1960s. "For years," he said, "I taught the thesis that . . . only the truth had rights. I was convinced of my error."

Nevertheless, he dissolved the Venice branch of the Young Catholic Organization because it endorsed leaving the choice of Catholics up to individual conscience in the 1974 Italian national referendum on legalizing divorce.

Patriarch Luciani also earned a solid reputation as a dedicated anti-Communist, and there were those who speculated that he might work against allowing the "historic compromise" to lead to its logical outcome - a governing coalition between the Communists and Christian Democrats.

There is much comment among Vatican observers to the effect that under his smiling exterior, John Paul was infact an anxious man whose fatal heart attack was the result of hypertension because of his sense of the burden represented by leading a worldwide communion of 600 million souls.

He gave clear indications of being preoccupied by the unabating wave of terrorism that has engulfed Italy.

Thursday night, three youths standing outside a neighborhood Communist Party headquarters were shot at by two motorcyclists. One of the three was killed.

The Italian news agency quoted a Vatican spokesman as saying that the pope, told of the incident, said, "Even the young people are killing each other."

Shortly after, the pope retired to his room, and the spokesman said those may have been his last words.

As he did in August, Jean Cardinal Villot, the chamberlain of the Vatican, took over interim administration of the church and direction of preparations for the funeral and for the election of a successor. Villot is also secretary of state, the equivalent of prime minister in the Vatican government.

"Albino, Albino, Albino," Villot called to the dead pope yesterday morning in the church's prescribed ritual of having the chamberlain repeat three times the pope's Christian name to verify that he is no longer living.

Also according to tradition, John Paul's papal ring will be hammered into uselessness along with his papal seal. The ring is known as the "fisherman's ring," a reference to St. Peter, the fisherman disciple who was the first bishop of Rome and was known as a "fisher of souls."

Telegrams of condolence poured into the Vatican from world leaders, including one from President Carter.

Italian Premier Giulio Andreotti said, "His smile will remain in the memories of all Italians as a sign of serenity and sweetness."

In their comments, a number of churchmen showed disquiet about the effect of having to go through the election of a new pope so soon. Alexandre Cardinal Renard, archbishop of Lyons and primate of France, spoke of the death as a "grave trail" for the church.

"It is obvious," he said, "that this death disconcerts us, but we Christians know very well that God keeps his church and that, in hope, we will soon elect a new pope. The church continues."

This time, the arrangements can probably go forward more rapidly than they did in August since so many of the preparations were done as recently, such as the careful enlargement of the Sistine Chapel to make room for all the members of the College of Cardinals during their deliberations.

When the doors to the Aposolic Palace were closed at dusk yesterday, there were 8,000 persons still lined up to view the body. The Italian news agency estimated that 200,000 persons had filed past the bier four abreast during the day.

Before the public was admitted, government leaders, high churchmen, and journalists viewed the body.

The Communist president of the Italian Chamber of Deputies, Pietro Ingrao, and the Communist mayor of Rome, Giulio Carlo Argan, joined top Christian Democrats in paying their respects. Communist Party headquarters all over Italy joined others in putting their flags at half-staff.

Schools were closed in mourning and a strike by cabin personnel of the Italian national airline, Alitalia, was called off out of respect for John Paul.