J. Roger Mentz, a Treasury Department official who was key to last year's rewriting of the nation's tax laws, will quit Aug. 1 and return to private legal practice, the Treasury Department said yesterday.

"I think that I've been here for a tremendously exciting time -- probably the most exciting time that any professional in tax policy could possibly be in," Mentz said. "It's also a grueling job, and it was either leave now or stay through to the end of the administration."

"Roger's commitment and expertise helped us overcome many of the obstacles and bring about true and lasting tax reform on behalf of the American people," Treasury Secretary James A. Baker III said.

The department said Mentz, assistant Treasury secretary for tax policy, would become a partner and tax specialist in the law firm of Cadwalader, Wickersham & Taft, which is based in New York but also has offices in Washington and Florida.

He is the second major Treasury official to leave in the past three months. Deputy Treasury Secretary Richard Darman resigned April 13 to join the investment banking group of Shearson Lehman Bros. Inc.

Before serving as assistant secretary, Mentz worked as deputy assistant secretary of the Treasury for tax policy from April to December 1985.