Interior Secretary James G. Watt resigned yesterday, driven from office by a flip remark about a coal advisory panel 18 days ago after more than 2 1/2 years of controversy over his stewardship of the nation's natural resources.

President Reagan stood by Watt to the end, even as election-minded Republicans on Capitol Hill called increasingly in recent days for his ouster.

"Jim has done an outstanding job as a member of my Cabinet and in his stewardship of the natural resources of the nation," Reagan said in a statement "reluctantly" accepting Watt's resignation yesterday. The president said Watt, throughout his tenure a favorite of conservatives, will continue to serve "until his successor is confirmed."

Watt is the second major administration official in the environmental field to resign this year. The first was his protege, Anne M. Burford, who quit under fire as head of the Environmental Protection Agency in March, to be replaced by a moderate, William D. Ruckelshaus.

Watt telephoned Reagan at Camp David, Md., shortly after 5 p.m. EDT yesterday and offered his resignation. In a letter delivered to the president less than an hour later, Watt said he is leaving because his "usefulness" to Reagan "has come to an end."

Shortly thereafter, Watt read his letter to reporters assembled in a cow pasture near a ranch in California's Santa Ynez mountains owned by former Interior Department aide Thomas Barrack, where he has been vacationing since last Wednesday. Then Watt and his wife, Leilani, mounted horses for a ride around the ranch.

White House counselor Edwin Meese III, who spoke by telephone with Watt before Watt's call to Reagan, said last night that discussions about a successor would begin today and that no one has been approached for the job. Meese said the discussions would continue Tuesday when Reagan returns from Camp David.

Speculation within the adminstration and on Capitol Hill has centered on former senator Clifford P. Hansen (R-Wyo.), who was Reagan's original choice for Interior in 1981, Rep. Manuel Lujan Jr. (R-N.M.), ranking Republican on the House Interior Committee, former senator James L. Buckley (R-N.Y.) and former House minority leader John J. Rhodes (R-Ariz.).

When asked by reporters, Watt declined to name a possible successor; a White House official said it did not come up in Watt's 10-minute conversation with Reagan.

Some top administraton officials have said they believe that Reagan should choose another western conservative in Watt's mold to reassure conservative activists who say they fear that Watt's departure will leave them without a voice in the Cabinet.

But others have said that Reagan should choose a more moderate figure, as he did with the EPA, to position himself closer to the political center for next year's expected reelection campaign.

In his statement last night, Reagan made no mention of the furor stirred by Watt on Sept. 21, when he characterized the members of a coal-leasing advisory panel as "a black, . . . a woman, two Jews and a cripple . . . ."

Rather, the president said Watt was leaving because he "feels that he has completed the principal objective that he and I agreed upon when he became secretary of Interior." Reagan added that Watt "has initiated a careful balance between the needs of people and the importance of protecting the environment."

But other Republicans made clear over the last 18 tense days that they felt Watt had finally gone out of bounds politically. Next year, 19 Senate Republicans face reelection, and it was the Senate Republicans, including some who had once been among Watt's strongest supporters, who led the way in demanding that he resign.

A stormy Senate GOP caucus meeting last week, at which it became evident that Watt was losing the support of his own party, apparently helped tip the balance in Watt's decision to leave. Meese said last night that the president "was distressed that there was this feeling in the Senate."

Although Watt's letter of resignation ignored the most recent controversy, he told reporters in California that the remark, the most recent in a series in which the fundamentalist Watt offended liberals, environmentalists, Indians, Holocaust survivors and assorted others, "did accelerate" his departure.

In the one-page letter, which he pulled out of his shirt pocket and read to reporters, Watt, who had said from the beginning that he might someday carry matters to the point where the president would have to fire him, cast his departure as "time for a new phase of management" at the Interior Department.

He made no reference to the string of more substantive controversies that have marked his tenure as trustee of the nation's natural resources, in which he has emphasized opening for development the government's vast storehouse of energy and other resources, from timber to coal to offshore oil.

The irony of Watt's departure is that none of these controversial policy decisions prompted him to quit, but his off-the-cuff remark at a Chamber of Commerce breakfast about the coal-leasing panel did.

The Watt and Burford resignations are emblematic of a political problem for the administration. It began as a champion of development and the freeing of the West from federal control. But there have been indications recently that conservation may be at least as popular as development even in the West. Burford also resigned after a prolonged period of controversy and criticism from the Congress.

Meese, who also spoke with Reagan after the Watt call, said the interior secretary's departure will not bring a change in the administration's natural-resource policies. He said he knew of no personnel shifts resulting from Watt's resignation.

Even as top administration officials were predicting that Watt would resign, Reagan last week defended Watt's record. Reagan also made it known to his immediate staff that he didn't want Watt railroaded out of office; as a result, his top aides sought to avoid any visible effort to push Watt. Instead, the pressure was allowed to build from Capitol Hill.

More than a dozen GOP senators demanded Watt's resignation. Private vote counts in the Senate showed that 15 or fewer members would back Watt if a no-confidence resolution came to the floor. Such a resolution was pending when Congress left for its Columbus Day recess.

Environmentalists hailed Watt's resignation last night, but expressed little hope that his policies would be revised.