Sen. John Glenn (D-Ohio) tonight courted environmentalists, who have been critical of him in the past, by accusing President Reagan of having the worst environmental record of any American president in the 20th century.

Glenn, in his first major speech on environmental matters, accused Reagan of cutting the Environmental Protection Agency's budget by 50 percent in the last two years, using the EPA and the Interior Department as "political footballs" and of pursuing an environmental policy that will "degrade the heritage of our country."

"With one exception every American president since Theodore Roosevelt--Democrats and Republicans alike--has honored a commitment to the environment," Glenn, a Democratic presidential candidate, told a crowd of about 500 at Keene State College here. "The one exception is Ronald Reagan."

Although Glenn broke no new ground in the speech, it was the most detailed account to date of his environmental views.

On acid rain, a politically sensitive issue in New Hampshire, he struck out at his opponents for the Democratic nomination, accusing "a few self-serving politicians" of playing "political gamesmanship" with the issue.

"Instead of assuming a posture, I have taken a position," he said. "I have a policy and I have a program."

The speech, which received a warm reaction, was part of an effort to build a detailed platform for Glenn, and to answer his opponents' criticism that he doesn't have clear positions on a host of issues.

Glenn described himself as deeply concerned about the environment and thoroughly committed to research on environmental problems.

But, as he has done on many other issues, he struck a middle-of-the-road approach.

"Environmental protection is costly," he said. "As much as we might like to, we cannot blindly promote environmental values without careful attention to the economic effects."

As a senator from Ohio, Glenn has been suspect among environmentalists for his reluctance to crack down on air pollution and acid rain problems caused by industries and utility companies important to the economy of his home state.

Glenn earlier had angered New Hampshire environmentalists by taking an indecisive position on acid rain, claiming that more research was needed.

Early in his presidential campaign he got into hot water in this environmentally conscious state by refusing to endorse a tough anti-acid-rain proposal that appeared on the agenda in 201 of the state's town meetings.

The resolution, calling for a 50 percent reduction in sulfur dioxide levels by 1990, was passed at 199 town meetings.

Glenn tried to recoup by meeting with environmentalists and coming out in favor of a mandatory 8 million to 10 million-ton reduction in sulfur dioxide emissions over the next 12 years in the eastern United States.

The plan would be financed by a surtax on electric bills in 31 states. Under the proposal, the typical New England family would have from 25 to 75 cents added to its monthly electric bill. In the Midwest, the amount would be 75 cents to $1.50.

Meanwhile, Glenn was advised to tackle another political problem in New England, it was learned today.

Sources said that Glenn had been advised to react strongly to charges by the campaigns of former vice president Walter F. Mondale and Sen. Alan Cranston (D-Calif.) that he is making a major effort to win the straw poll at Maine's Democratic state convention on Oct. 1.

Glenn had said earlier that he would no longer compete in such polls. According to the sources, Glenn has been told that what his campaign is doing in Maine is normal political activity aimed at winning delegates next year.

Glenn has been told that the campaign has spent only $7,162 in Maine to date. He has visited the state only eight times since last April, but there have been mailings and volunteers have formed telephone banks in his behalf.

Tonight's speech was the first of three major addresses Glenn has scheduled early this week as part of a fall offensive to portray him as something more than a former astronaut and war hero.

Glenn has two major speeches scheduled for Tuesday. The first is before the annual New Jersey state Democratic convention, which will conduct a presidential straw poll later in the day.

Glenn is the only Democratic contender scheduled to appear before the group, and his supporters hope this will boost his chances of winning the straw poll.

The second speech is a Mideast policy address in New York City aimed at reassuring Jewish leaders who have doubts about the depth of his commitment to support Israel.