Navy Secretary John F. Lehman Jr. yesterday reinstated a California air base wing commander whom he relieved of duty six weeks ago because of purchases of overpriced spare parts, including $659 aircraft ashtrays.

But Lehman reaffirmed his decision to remove the base commander and supply officer at Miramar Naval Air Station near San Diego, contending that they ignored high-level directives to correct "longstanding deficiencies" in such purchasing.

In reinstating Rear Adm. Thomas J. Cassidy Jr., Lehman said an internal Navy investigation found "insufficient ground" to hold the wing commander accountable for overpriced spare parts at Miramar because primary responsibility for overseeing the purchases rested with the base commander, Capt. Gary E. Hakanson.

At the same time, Lehman said Cassidy will be given a nonpunitive "letter of instruction" because the investigation showed that he should have taken "more aggressive actions" to implement the Navy's spare-parts purchasing reforms.

Cassidy could not be reached for comment. Hakanson, who plans to retire Aug. 1, said in a telephone interview that he is disappointed by Lehman's decision. He said he "fulfilled my responsibility as commanding officer."

Cmdr. Jerry L. Fronabarger, Miramar's former supply officer, also could not be reached. His Navy counsel, Cmdr. William D. Hoover, said in a telephone interview that Fronabarger's performance "was far above standards" and that he will recommend a petition to President Reagan for reconsideration of the case.

"Normally when someone is relieved, there is misconduct," Hoover said. "In this case, no misconduct occurred."

Lehman dismissed the three officers May 31, saying that he had lost confidence in them because Miramar paid Grumman Aerospace Corp. $659 apiece for 4-by-4-inch chrome aircraft ashtrays and $404 each for socket wrenches. In addition, the price of landing-gear clamps rose more than 2,500 percent over a 16-month period.

Navy personnel registered unusual public protests about the dismissals. They accused Lehman of making scapegoats of the three to show his resolve in dealing with procurement scandals undermining the Reagan administration's drive for a defense buildup.

Cassidy, 52, is believed to be the first admiral relieved of duty because of contracting problems. He and Hakanson, 47, said they had assumed their posts long after the controversial purchases and said that they were dismissed without due process.

Fronabarger, 43, has argued through his counsel that he complied with policy set by superiors.

Faced with what Navy officials said was a serious morale problem, Lehman immediately ordered the internal investigation and promised to reinstate the officers if they were exonerated.

Investigators completed work in late June and recommended that Cassidy and Hakanson be cleared, according to Navy officials. But Lehman, while reversing himself on Cassidy, felt compelled to observe the Navy tradition of assigning blame for any problem to those directly in charge, the officials said.

In a news release yesterday, Lehman said his decision was based on recommendations by Adm. James D. Watkins, the chief of naval operations.

"Longstanding deficiencies concerning spare-parts purchasing extending through the tours of both officers appeared in the investigation to confirm a failure at Miramar to heed the well-publicized, high-level directives designed to overcome unreasonable spare-parts pricing," Lehman said of Hakanson and Fronabarger