Military service is more demanding of sacrifice than are civilian professions, President Reagan said in an interview published yesterday, and he disputed Office of Management and Budget Director David A. Stockman's charge that military retirement pensions are bloated.

He also distanced himself somewhat from Stockman's assertion that farmers who face foreclosure got themselves into difficulty and shouldn't be bailed out by the taxpayers. He acknowledged, however, that despite an effort to restructure farm debts, many farmers will go bankrupt.

Reagan said the military is "a little different than any other pension program you want to name" and cited the extraordinary sacrifices made by career servicemen.

In an interview with The Wall Street Journal, Reagan said the "physical requirements of military service are such that they're going to be out" at an age when their contemporaries in other professions are at their prime.

He recalled that he had talked with a retired officer who told him that one reason he retired was that "in the call of duty, for 20 of his 31 married years . . . he and his wife had not been together. He was out there in the world someplace."

He contended that a major cause of farmers' current troubles, ironically, was the success in reducing inflation, which had helped drive up the price of farm land. This overvalued land was used as security for farmers' loans, he said, and when land prices dropped farmers were extended beyond their real value.

"It's the result of ending an era of building your business on expected inflation," he said. "And farm land, unfortunately, was one of those things that, in an inflationary world, zoomed in value. And then they borrowed on the basis of that as security. And when we were successful in bringing down inflation, one of the first things that happened was the nose-diving of that land."

He said his administration is offering "a program in which we're hopeful that we can salvage some of those farmers."

Reagan said his "Star Wars" plan to intercept enemy missiles in space is tied to the goal of arms negotiations -- "the elimination, ultimately, of nuclear weapons" because an aggressor would not be sure that "enough of their missiles could get through and in return we could launch the retaliatory strike."

"If you could have that kind of a defense in which they would have to say, 'Well, wait a minute, how many missiles would we have to build to get enough through on a first at- tack . . . ' "

Reagan also repeated his contention that the Democrats, who have controlled Congress for more than a half-century, are responsible for the national debt, which was nearly $1 trillion when he took office four years ago. The fiscal 1985 debt is estimated to be $1.8 trillion.

"And the first of those major big deficit increases incurred -- well, it occurred after I was in office," he said. "However, it was not my responsibility because your first eight months in office, you're on the other fellow's budget . . . . When the bottom fell out of the economy in July of '81, not one facet of my economic program had been passed . . . it couldn't have had anything to do with that deficit."

He said that when Congress insists that a president spend more money than he thinks necessary and even insists that money left over at the end of the year has to be spent, the result is "a built-in, structural deficit."

He cited the Great Society War on Poverty -- which "poverty won because the rate of increase in people on poverty increased in spite" of it.

" . . . From 1965 to 1980 the budgets multiplied to five times what they were," he said. "The deficit went to 38 times what it had been."

He criticized the Sandinista government in Nicaragua because it "betrayed the principles" of the revolution, and he argued that "we should be on the side of those people who actually are only asking for the democracy that they'd fought a revolution to get."

In a White House ceremony, Reagan helped blow out the candles on a cake commemorating the 75th anniversary of the Boy Scouts.

"I'm delighted to celebrate anything older than I am," joked Reagan, who turned 74 Wednesday. The president, who was not a scout but is honorary president of the organization, noted that former scouts "have walked on the moon, become president and won the Heisman trophy. Today they serve as Cabinet secretaries, as my press secretary James S. Brady, an Eagle Scout and in the Congress."