The Federal Election Commission took about five seconds yesterday at its public meeting to tell White House aide Margaret (Midge) Costanza the obvious - that she could take her surplus campaign funds and give them to two charities.

The federal election law specifically permits use of surplus election funds for "any legal purposes," including gifts to tax exempt charities.

Costanza got into trouble last October when she failed to follow another obvious section of the election law, that requiring a report on funds raised.

Last April, two months after joining the White House staff as assistant to the President for public liaison, Costanza held a $500-a-ticket fund-raiser to wipe out a $17,615 debt from her unsuccessful 1974 congressional campaign. All but $750 of that amount was owed to Costanza.

The cocktail party, featuring an appearance by Vice President Mondale, was a big success. She raised $21,025, and promptly repaid what she owed herself.

Seven months and two FEC reporting periods went by before Costanza got around to filing the required reports on the party.

When news stories disclosed the filing failure, Costanza initially was snippy. Later she turned contrite and admitted she had made a mistake.

Now, the controversial Carter aide is defensive - possibly because several Republican congressmen have called for her resignation.

FEC aides were surprised when Costanza asked the commission for an advisory opinion on whether she could give her roughly $3,000 surplus to the American Cancer Society and a handicapped children's camp in her home county of Monroe, New York.

"It is clear," the FEC opinion yesterday said, that giving the funds to charities "is expressly made lawful . . ."

An FEC spokesman yesterday said there could be no comment on whether an inquiry was being made into the Costanza case. FEC rules require confidentiality on any compliance investigations.

But the spokesman said there was no record of any penalty or fine ever being assessed against a late filer.