Donald J. Devine yesterday resigned the temporary government job he held while his controversial renomination to head the nation's civil service was stalled in a Senate committee, but he said he expects to be confirmed shortly for a second term as head of the Office of Personnel Management.

The impact of Devine's unexpected move, which caught Republican and Democratic Senate staff members by surprise, was not immediately clear.

Devine said he was resigning to clarify the "tangled lines of authority" that arose in the OPM when he was temporarily demoted to serve as a $72,300-a-year "special assistant" while awaiting reconfirmation.

Devine's vigorous 1984 political campaigning on behalf of 16 Republican candidates aroused strong opposition from Senate Democrats who accused him of improperly politicizing the OPM post.

Devine, who denied the charges, said yesterday that he expects President Reagan to stand firmly behind his renomination.

"I fully expect to be confirmed by the Senate within a month," Devine said. "I am going to go home and wait, that's all."

Devine said his resignation, effective immediately, came after acting OPM Director Loretta Cornelius told him, "I don't think I can go on this way" because she believed Devine's presence undermined her authority.

Devine said he called the White House early yesterday to make known his plans. "I didn't get their approval . . . and they said, 'Do what you think is right,' " he said. The White House had no immediate comment.

Patrick Korten, Devine's chief spokesman, said Devine "was not pressured by the White House to withdraw and will not ask President Reagan to withdraw his name from consideration" for a new four-year term as OPM director.

Devine had been serving as a special assistant since March 25 when his first four-year term as OPM director expired. Most political appointees serve unlimited tenure at the pleasure of the president, but the Civil Service Reform Act of 1978 gave the OPM director a fixed term.

The Senate Governmental Affairs Committee, controlled by a 7-to-6 GOP majority, postponed a vote on Devine last month when it appeared that confirmation would be blocked by solid Democratic opposition and a possible "no" vote by Sen. Charles McC. Mathias Jr. (R-Md.). Mathias is reported to be leaning against the nomination but has not declared his position.

"I think committee members are ready to confirm me, despite anything you've heard about some of the Republicans not supporting me," Devine said yesterday. He added that Reagan has "made it clear I'm his guy" and that the White House is trying to persuade Mathias to vote for Devine.

"We are operating under the assumption that he still wants the job, and we still intend to bring up his name," said John Duncan, staff director for committee Chairman William V. Roth (R-Del.).

Devine has aroused bitter opposition among federal employes -- and praise from some Republicans -- because he is chief architect of Reagan administration plans to cut federal jobs, pay and pension benefits, and to revamp personnel rules regarding promotion and hiring.

"He is off the payroll and we hope he stays off," said Kenneth Blaylock, president of the American Federation of Government Employees.

OPM acting Director Cornelius was not available for comment. She named John L. (Lin) Kill Kelley, a career OPM employe, as acting director of public affairs and the only authorized spokesman for the agency, temporarily replacing Devine aides.