Jim Palmer gazed sadly over the edge of a desolate gray mine pit on rugged Dans Mountain near here. Weeds have started to grow in the deserted coal field. A huge, red crane-like hauling machine stands idle, its tracks and bucket rusting.

Two years ago, Palmer's company, Phillips Coal Inc., was Western Maryland's largest coal producer. Today, its seven mines have been shut down and the company has laid off all but 13 of 81 employes.

"I'd like to know what I'm going to do," said Palmer, a tall soft-spoken man in a coyboy hat and boots, who is general forman of Phillips' operations here. His sense of frustration mirrors the serious troubles that many of the nation's coal producers say they are facing at a time when the Carter administration is calling for a sharp increase in coal production.

Producers say what has happened to Phillips resembles what is happening in many coal fields in the East. The coal industry is caught with a glut of coal -- the result of what producers argue are contradictory crosscurrents in the federal government's energy policies.

Two years after President Carter called for doubling the nation's coal output to 1.2 billion tons by 1985, the industry remains in the doldrums. The National Coal Association says the industry's growth rate is sluggish, less than half the 5.8 percent yearly pace needed to reach the Carter administration's goal.

This year the coal association says the industry will produce a record 724 million tons, but the record is partly the result of gains in Western coal production which have offset the slump in the East, where most of the nation's coal is mined.

Ironically, industry officials say, America's coal mines can produce far more coal than the nation wants. The coal association estimates that if the mines were operating at full strength, they would extract 100 million excess tons of coal a year -- coal that no one would buy.

One reason for this coal glut, officials say, is that America's use of electricity now is growing at a significantly slower pace than once was expected.

Electric power plants are the main purchasers of U.S. coal. Output of electricity had grown at a yearly rate of about 7 percent during the 1960s and early 1970s, but it fell off sharply to 0.2 percent in 1974 after the Arab oil embargo. The Edison Electric Institute, an industry group, predicts that electricity generation will rise at just 4.5 to 4.8 percent annually through 1985.

With the coal market sagging, thousands of miners have been laid off in Western Maryland, Southwest Virginia, West Virginia and other coal company employees are working shortened workweeks. Some coal miners have been shut down in the Appalachian region and a number of small companies have gone bankrupt.

Although Western Maryland produces only a tiny fraction of America's coal, it is in some respects a barometer of industry trends. Much of Maryland's coal is sold on the "spot" market -- through single purchases or short-term contracts rather than long term contracts. The result: Maryland's coal industry quickly matches the ups and downs of the coal market.

The Phillips company was among several attracted to this economic roller coaster. Phillips started operating in Maryland in 1974, when hopes of a coal boom were rising. George D. Shropshire, the firm's executive vice president, said in an interview in his small LaVale office that Phillips had invested $6 million in its Allegany County mines while business was growing. The company operated profitably, he said, until 1977 -- Maryland's top recent coal production year.

"Then the market began to fall apart in 1978 and it's been going downhill ever since," Shropshire said."We haven't produced any coal since April 29."

The economic downslide has taken a toll. Paul Knieriem, a pneumatic drill operator for Phillips, is out of work, laid off when the company closed its mines. At Phillips, he was earning $300 or more a week. Now he supports his wife and seven children on a $106-a-week unemployment check.

"Jobsare like gold to find," Knierlem, 47, said in an interview at his yellow frame home near Frostburg. His unemployment benefits, he added, will end in three weeks.

For Allegany County -- an area of traditionally high unempolyment that is now trying to achieve an economic rebirth -- the coal industry's slump has proved unsettling. In an interview at his furniture store in Cumberland, John J. Coyle, president of the Allegany County commissioners, noted that the downturn in the coal business has had a "rippling" economic effect on other local industries. Sure, we're concerned," he said.

Despite the coal industry's gloom, many officials express at least guarded optimism about coal's long-term future. Matthew Skidmore Sr., Allegany County's leading coal booster and president of the Maryland Coal Association, is no exception.

Skidmore owns a small strip mine, drives a fuel-efficient car bearing a "COAL 1" license plate, and heats his home and swimming pool with coal. Today, he asserted in an interview, "there's just no market for coal."

Eight coal companies, he said, have gone bankrupt in Western Maryland in the past year. Yet, he added, "I feel there is going to be a coal market -- and a good market -- (eventually), but it's up to the federal government."

Coal industry officials in Washington and a number of coal-producing states blamed the industry's problems, in recent interviews, on a wide range of factors.

They said that the federal government has not taken strong enough steps to convert oil-buring electric power plants to coal. They sharply criticized the Clean Air Act and other federal environmental restrictions. Officials also argued that President Carter's synthetic fueld program, which aimed at 1990, will probably not improve the coal market in the short run.

In Carter's defense, Michael Koleda, executive director of the president's commission on Coal, contended that it is unfair to "pin Carter with the 1.2 billion" ton coal target for 1985. Koleda said that the same goal had been set by the Nixon and Ford administrations. It was based, he said, on faulty preliminary data that failed to take into account the recent slowdown in electric power growth.

Koleda argued, moreover, that the 1.2 billion ton target may still be reached by 1985 or soon afterward if the administration embarks on a stepped-up campaign to convert oil-fueled utilities to coal.

The layoffs, cutbacks and mine shutdowns in Western Maryland and Southwest Virginia reflect two separate economic problems that currently beset the nation's coal industry, according to industry officials.

Maryland's coal contains relatively large amounts of sulphur. Its sulphur content averages about 2.5 percent and ranges to as much as 5 percent, according to industry officials. Relatively high-sulphur coal is also produced in northern West Virginia, Ohio, western Kentucky, parts of Pennsylvania, Indiana and southern Illinois -- all areas where officials describe the coal market as slack.

Because sulphur contributes to air pollution, relatively high-sulphur coal is less desirable and more difficult to sell than low-sulphur coal, according to industry officials. Electric power plants normally cannot comply with air pollution restrictions by burning high-sulphur coal unless they install costly devices called scrubbers.

The coal slump iin Southwest Virginia stems mainly from another economic cause -- a factor largely unrelated to the nation's energy outlook. Most coal mined in Virginia is metallurgical coal -- coal used to produce coke, and ingredient in steel manufacturing. Coking coal is also produced in southern West Virginia, eastern Kentucky and parts of Pennsylvania and Illinois.

The metallurgical coal market is sagging because of complex international and domestic trends. According to industry officials, these include sluggishness in the international steel industry, stiffer competition from foreign coal producers, increased U.S. imports of foreign-made coke, and problems confronting American steel manufacturers in bringing their coking ovens into compliance with air pollution regulations.

In Virginia, the biggest cutbacks so far were announced last month by Clinchfield Coal Co., the state's largest mining firm. Clinchfield, a subsidiary of the Pittston Co., a major U.S. coal exporter, laid off 550 of nearly 3,000 workers at seven Virginia mines. A Pittston Co. spokesman attributed the layoffs chiefly to the international steel slump, citing a falloff in exports, especially to Japan.

In contrast with the Appalachian coal regions, the current market is said to be brighter in the West, where low-sulfur coal is prevalent. The National Coal Association has estimated that coal output is rising at a yearly 13.7 percent pace in the West, while declining at a 15.5 percent rate in coal-producing states east of the Mississippi River. Nonetheless, spokesmen for coal companies operating in the West expressed concern last week about what they described as a shortage of freight rail cars to haul coal to prospective customers.

Moreover, the eastern states remain the nation's leading coal producers. In West Virginia, which ranks among the top three coal-mining states, mining officials describe their outlook bleakly.

"We shut the mine down on April 30," said Richard Bolen, general manager of Reliable Coal Corp., an independent West Virginia firm. The company laid off all but five of its 190 employees. "It's a stagnant market sisuation," Bolen said.