Five months ago, Philadelphia Mayor Bill Green was working hard for presidential candidacy of Sen. Edward M. Kennedy (D-Mass.). On primary day in April, Green and Philadelphia delivered, handing Kennedy a 2-to-1 vote over President Carter that carried him to a narrow statewide victory.

Today, Green was out again on the streets of Philadelphia, campaigning for a presidential candidate. But this time the man at his side was the president, who hopes to be as much the beneficiary of Green's support in November as Kennedy was in April.

Green's presence with Carter, during a day that was largely devoted to picture-taking in some of the city's ethnic nieghborhoods, was an important symbol of the unity the Carter campaign hopes will allow the president to carry Pennsylvania against Republican presidential candidate Ronald Reagan.

Late today, Carter's hope for Democratic unity in a state where the Democratic primary was bitterly contested received another boost when he announced to an audience in a black Baptist church that Kennedy had just called him "to express his hope to you that the Democratic Party will be united in November and fervent in our work between now and then."

After opening his campaign in the South and moving on to the Midwest on Tuesday, the president made his initial foray into the industrial Northeast today, choosing a city where he was demonstrably weak during the primaries in a critical swing state.

Trailed everywhere by his own camara crew, which was shooting footage for later use in television commercials, Carter spent a leisurely day against the colorful backdrop of Philadelphia's ethnic neighborhoods.

He stopped first at a south Philadelphia community center, where he was serenaded by a group of preschool children who sang "Good Morning Mr. President, how are you," and where he played an Italian version of bowling called bocce.

Carter then toured the city's Italian Market section, at one point shaking hands with a chicken drumstick thrust at him by a food vendor. He had a lunch of corned beef and cabbage at an Irish bar and restaurant and ended up at the Zion Baptist Church in a black neighborhood on the city's North Side.

The crowds that turned out to see the president were modest, but that seemed of little concern to his aides, who clearly planned this day as one long "photo opportunity" of Carter mingling with big-city residents.

Reagan, the subject of harsh criticism by the president Tuesday in Independence, Mo., was barely mentioned. In his only direct reference to his GOP opponent, Carter told the audience at the Zion Baptist Church that Reagan had suggested that participation in the Social Security System be made voluntary, a change that Carter said would "destroy" the government benefit program for the elderly.

The president provided no documentation for the charge. In 1976, Reagan raised a brief flap when he suggested that Social Security funds might be invested in the stock market.But throughout his campaign this year, he has consistently pledged strong support for the system and promised to do nothing to weaken it.

Carter also warned his black audience members that they could not afford a repetition of 1968, when Hubert H. Humphrey lost to Richard M. Nixon in part because of divisions in the Democratic Party.

With Nixon's election, the president said, "The great strides that had been made in civil rights under Lyndon Johnson and John Kennedy came to a screeching halt. And we heard code words like "state's right's again . . . and we heard of a so-called Southern strategy that to me was an insult to the south this nation down in its progress, and it was a threat to all those who sought equal treatment and justice and opportunity."

The appearance at the church ended ideally for Carter -- with him and Green hands in a show of unity as the church choir sang "The Battle Hymn of the Republic."

Despite the trouncing the president received here in the primary, Green told reporters he expects Carter to do better in Philadelphia than in any other big city in the country in November. The reason, he suggested, was the radical change in the nature of his opposition.

"He would have done just as well back then [in April] against Reagan,' Green said.

Before returning to Washington the president was interviewed by a local television station. Defending his opposition to the inclusion of independent presidential candidate John B. Anderson in the first of the presidential debates, Carter described Anderson as "basically a Republican" and said he was not eager to promote a race between himself and "two Republicans."

Today was Carter's final day of campaigining this week. He is not scheduled to make another campaign trip until Tuesday, when he will participate in the opening of a new steel plant in Perth Amboy, N.J.