After a spectacular show of patriotic fervor featuring the U.S. Marine Corps Drum and Bugle Corps playing "Stars and Stripes Forever" and a huge flag unfurling from the top of of Constitution Hall, President Reagan yesterday told about 500 of his appointed government executives to be encouraged about the future because they are Americans.

"All we need is to believe in ourselves," the president said as his entire Cabinet sat behind him on the stage, "to remember that we are Americans and in this country we make the future work for us."

In recounting the achievements of his administration during its first two years and encouraging the appointees to continue efforts, Reagan told them not to be discouraged because they are facing national problems that were mounting before he came to Washington.

"This is no time to be swayed by Washington's whining voices, with their crying towels," he said. "I know it's true that sometimes you don't get a fair shake. But if you get discouraged, I want you to remember some words a poet I've always admired once penned. His name was Robert Service and he wrote:

" ' . . . You've had a raw deal! I know--but don't squeal/ Buck up, do your damnedest, and fight. It's the plugging away that will win you the day/ So don't be a piker old pard!/ Just draw on your grit; it's so easy to quit/It's keeping your chin up that's hard.' "

After Reagan spoke and shook hands with each Cabinet member as the appointees stood cheering, a sign appeared in the balcony reading, "Six More Years."

Throughout his speech, the president repeated the theme that the country's problems were worse when he was elected. He told the executives to remember that "we inherited a mess, we didn't run away from it and now we're turning it around."

He thanked them for helping him lessen the amount of time that Americans spend on government paperwork. He said with their help the federal "bureaucratic monster who would slay private enterprise is learning a new command. It's called--heel!"

Reagan praised the Cabinet as he spoke, turning to ask two departing secretaries, Richard S. Schweiker of Health and Human Services and Drew Lewis of Transportation, to stand for a long ovation, and then asking their nominated replacements, Margaret M. Heckler and Elizabeth Hanford Dole, to stand.

After they were applauded, Reagan said he was surprised to read that the addition of Dole and Heckler meant that he now would have two women in the Cabinet.

"That's not quite right," he said. "We have three. Mrs. Jeane Kirkpatrick is not only a member of the Cabinet, she is without a doubt one of the finest ambassadors to the United Nations this country has ever had . . . . She has made one message clear to every member of the U.N.: The defense of American interests is tantamount to the defense of national independence . . . . "

As evidence of the administration's accomplishments in the past two years Reagan said he sees a "new confidence building across America" and attributed it to the administration's having:

* Reduced the rate of inflation, interest rates and federal income taxes.

* Saving the Social Security System and "reversing the dangerous decline of this nation's defenses."