Geraldine A. Ferraro has finished filming a 30-second television commercial for Diet Pepsi which she agreed to undertake because of guarantees of "artistic control" and a fee of more than $500,000, according to aides for the erstwhile 1984 Democratic vice-presidential nominee.

Her participation in the commercial, filmed last Friday near Ferraro's house in Queens, was opposed by some of her former campaign advisers, who fear that she will be accused of exploiting her political fame for financial gain and will thereby undermine her chances for a comeback next year if she chooses to run against Sen. Alfonse M. D'Amato (R-N.Y.), as she has considered doing.

"It's a gamble, there's no doubt about it," said Francis O'Brien, who served as Ferraro's press secretary during the 1984 campaign and continues to advise her. "The worst that can happen is that she got a fair sum of money."

The deal with the Pepsi-Cola Co. comes on the heels of a $1 million contract for Ferraro's memoirs, which she is writing for Bantam Books with a target completion date of April. It also comes to light just as another Ferraro controversy appears to have ended with the sentencing Wednesday of her husband, John A. Zaccaro, to 150 hours of community service for his part in a fraudulent real estate loan scheme.

Pepsi first approached Ferraro about three weeks ago with "a terrific offer" as part of a new ad campaign using nationally recognized "leaders" to emphasize a basic motif of "choices," O'Brien said. That apparently reflects Diet Pepsi's pursuit of a larger share of the low-calorie soft drink market against such competitors as Diet Coke.

Chrysler Corp. chairman Lee Iacocca also has filmed a Diet Pepsi commercial, which probably will be unveiled Sunday, O'Brien said. Pepsi also is negotiating with ballet star Mikhail Baryshnikov.

Pepsi spokesman Steve Houser yesterday said, "We have not confirmed any relationship with Geraldine Ferraro to the media . . . . Any rumors you may have heard are clearly that and purely speculative."

In a telephone interview from Pepsi's headquarters in Purchase, N.Y., Houser also declined comment on possible company ties to Iacocca or Baryshnikov. The only recent celebrity commercial filmings the company will confirm were with singer-composer Lionel Ritchie and the pop singing group Menudo.

O'Brien said "we got to write the ad" for the Ferraro commercial which is in final editing this week and will be aired widely in early March.

It depicts Ferraro, who is neither identified by name nor shown full face, with her two daughters, Laura, 22, and Donna, 18. After some opening banter, Ferraro discusses career possibilities with her daughters and concludes that "there are lots of choices for women and one of the choices is that you can be a mother," an echo of her campaign speeches last fall.

"They don't hawk the product" overtly, O'Brien said, but the scene probably will include a can of Diet Pepsi on a table as a prop.

"Somebody asked, 'Is this a public service announcement?' I said, 'No, it's an ad,' " said O'Brien, who is known for his irreverence.

There has been no dearth of advice for Ferraro from former staff aides about how she should make a living while keeping her political options open.

O'Brien, while urging her to do the commercial, opposed the book contract on grounds that full-disclosure memoirs would provide ammunition for Ferraro's political enemies, while lack of candor would be condemned by critics and political commentators.

Some former aides believe that Ferraro can make money while enhancing her image as a stateswoman and Democratic Party leader by sticking to the lecture circuit, where she can command as much as $20,000 an appearance. There also have been suggestions that she use a New York law firm as an occupational base much as running mate Walter F. Mondale did in Washington after he left the vice presidency in 1981.

Ferraro will turn her attention to the Senate race in May after finishing her memoirs, O'Brien said.

Some observers, including several close to Ferraro, believe she may find it difficult to survive New York's Democratic primary, much less prevail against D'Amato, whose popularity ratings have climbed, and who already has amassed a large reelection war chest.

Ferraro supporters hope that Zaccaro's sentencing to community service will halt the intense preoccupation with the couple's financial affairs, which began virtually as soon as Ferraro was selected last July to be the first woman on a major party's national ticket.

"Ninety-nine percent of the people in this town will assume that by doing this commercial that she's dead politically," O'Brien said. "But I find it interesting that Pepsi-Cola must be seeing something in their market research about her appeal."