President Reagan chose a speech to Medal of Honor winners here today to defend his reliance on military force around the world, saying that "weakness on the part of those who cherish freedom inevitably brings on a threat to that freedom."

"With the best of intentions we have tried turning our swords into plowshares hoping others would follow," Reagan said. "Well, our days of weakness are over. Our military forces are back on their feet and standing tall."

Reagan, in a relatively brief and emotional speech that aides said he wrote himself, referred to the deployment of Marines in Lebanon and the invasion of Grenada as necessary acts in defense of American values and interests.

"When our citizens are threatened, it is government's responsibility to go to their aid," he said of the invasion. "We did so in Grenada. Our forces had what they needed to get the job done.

"And now the world knows that, when it comes to our national security, the United States will do whatever it takes to protect the safety and freedom of the American people.

"Once again, it's an honor to wear the uniform and serve our country, and our servicemen and women feel that.

"I hope that makes you as proud as it does me."

The speech was Reagan's second in three days in defense of his use of armed force. He devoted his regular radio speech on Saturday to the Mideast, saying that U.S. actions there have been restrained to date, given the provocations. In the last six months, 257 U.S. servicemen have been killed in Lebanon, and Reagan aides say they think that when Congress reconvenes next month it could move to bring the troops home if the toll continues to rise.

The president, in his remarks to the Medal of Honor Society, said, "Freedom is never more than one generation away from extinction. Each generation must do whatever is necessary to preserve it and then pass it on to the next. And that means dealing with the world as it is, not as we would like it to be.

"If we turn a blind eye and a deaf ear when totalitarian regimes brutalize the hopes and dreams of people, we demean the valor of every person who struggles for human dignity and freedom--and all those who have given the last full measure of devotion."

Reagan used the speech to stress his defense buildup as well as his foreign policy. Warning that "tyrants are tempted" by weakness, he told his sympathetic audience that "modern equipment is being delivered to the troops, and more is on the way . . . . M obility and firepower . . . are being strengthened . . . . No longer is America's military being asked to defend freedom with equipment from wars past."

But Reagan said, "We do none of this because we seek war . . . . Peace with freedom is the highest aspiration of the American people. We will negotiate for it, sacrifice for it, but never surrender for it. Our commitment to significant arms reductions is unshakable. We will not give up our search for peaceful solutions in the Middle East, Central America and elsewhere."

The president's speech was given an enthusiastic reception by his audience.

Outside, as Reagan spoke, demonstrators chanted slogans, including "Reagan wants another war, we say no," and "More money for jobs, not for Lebanon."

Back inside, Reagan said, "An America that is militarily and economically strong is not enough. The world must see an America that is also morally strong, with a creed and a vision. We are such people."