"The Ronald Reagan March" may never go down in history with "Stars and Stripes Forever," but it's the thought that counts.

Yesterday, at a surprise 77th-birthday party for President Reagan, it counted for a lot more than the song's composer -- Marvin Hamlisch -- or the person who "commissioned" it -- Nancy Reagan -- ever expected.

"I used to think I wanted an Oscar," Reagan said after what might best be described as the tune's world premiere at the White House.

"A song of my very own!" he crowed when Hamlisch gave him a framed copy of the music. "I gotta take singing lessons."

Standing tall if not yet bursting into song, Reagan took his birthday bows a day early to applause from about 70 guests -- "so dear to me" -- as he described the Cabinet officers, senior White House staffers, longtime political friends and spouses assembled at the Valentine-themed tables before him.

Of Mrs. Reagan, who concocted the surprise party, he feigned awe.

"I knew you got away with making a deal with the Soviets," he quipped, an apparent joke about former aide Michael K. Deaver's new book, "Behind the Scenes," in which the first lady is described as a veritable backstage president pushing for conciliatory solutions to U.S.-Soviet problems. "But I never believed you could accomplish anything like this."

He drew laughter and a few cheers a little later after blowing out seven of his eight candles. "Get rid of that," he said, picking up the eighth and giving it to Mrs. Reagan. She pushed him toward a seat at the table on his left. "See," he cracked, "she was trying to push me to the left."

"We really did pull it off -- he was surprised," Mrs. Reagan said when she welcomed the guests. "I know it was kind of a last-minute thing, and a lot of you had to change plans. But then you know I did, too.

"I've been awfully busy with arms control, the INF Treaty, the Russians," she said, not to mention her entry into big-time basketball Thursday night in Indiana, where she took her "Just Say No" antidrug campaign.

To introduce "He's Our Man (The Ronald Reagan March)" Hamlisch recruited eight members of the Marine Band as backup brass and brought Donna Marie Elio from Broadway to belt out the words while he pounded out the melody on a small piano he had wheeled into the State Dining Room:

"He's our man/ And he's giving his best/ He's our man/ And he's up to the test/ He has done the job the best that anyone can," she sang.

She continued for five more stanzas with such variations as "He's our man/ And we all want to say/ That we're glad/ That he did it his way" and "He's our man/ He's the Gipper to me," ending with, "Happy birthday, Mr. President/ God be with you every day."

No one was seen tapping toes, but there were smiles on the faces of many guests, including Chief of Staff Howard Baker, national security adviser Colin Powell, former senator Paul Laxalt, White House Press Secretary James Brady, White House spokesman Marlin Fitzwater, second lady Barbara Bush, consultant Nancy Reynolds, USIA Director Charles Wick and others.

Among those at the president's table were Ursula Meese, wife of Attorney General Edwin Meese III; Margaret Verity, wife of Commerce Secretary C. William Verity; and the secretaries of health and human services, interior, labor, and housing and urban development. Until Mrs. Reagan switched places with Labor Secretary Ann McLaughlin for the dessert course, among those at her table were Hamlisch, Meese and Energy Secretary John Herrington.

Lunch consisted of beef consomme', filet of sole, gingered broccoli and rice timbale, accompanied by a 1984 Jordan chardonnay wine. The presidential birthday cake, by White House pastry chief Roland Mesnier, was two-tiered lemon decorated with chocolate horseshoes, a saddle, a pair of boots, a cowboy hat and two bucking broncos.

It being "the 38th anniversary of my 39th birthday," one thing came to mind, Reagan said. "What are you going to do for the 39th?" he asked the first lady.

Later, flying off to Camp David for the weekend, he received yet another surprise, a mock certificate from his staff proclaiming 1988 as "the best of eight" years in the White House.

There were no plans for a birthday celebration today. None of his children is expected to join him.

"I'm sure we'll hear from all of them over the weekend," said Elaine Crispen, Mrs. Reagan's press secretary.