Lt. Gen. Alfred M. Gray Jr., the Atlantic fleet commander of the Marine Corps, has been recommended to President Reagan as the new commandant of the corps after an internal political skirmish over the future of the embattled service, Pentagon officials said yesterday.

Navy Secretary James H. Webb Jr. reportedly selected Gray over two other high-ranking Marine officers after "a real brawl" in the Defense Department, sources said. Webb's recommendation was endorsed by Secretary Caspar W. Weinberger and sent to the White House Tuesday, officials said.

The decision was controversial within military circles because "some people believe he {Gray} lacks the smooth edges you normally see in Washington," one Pentagon official said.

But Gray's supporters characterize the three-star general as having "credibility inside the Marine Corps as a leader," the official said.

If confirmed by the Senate, Gray would take over from retiring Gen. P.X. Kelley at a time of intense scrutiny both internally and externally. The recent Moscow spy scandal, in which embassy guards were charged with espionage, has tarnished the corps' image.

In addition, Webb has ordered a study to reexamine the mission of the corps to determine whether it is designing too much of its hardware to support amphibious operations even though that has become a much smaller part of the corps' overall role.

Gray reportedly was selected as the commandant nominee over Lt. Gen. Thomas R. Morgan, assistant commandant, and Lt. Gen. Ernest C. Cheatham Jr., deputy chief of staff for manpower, according to Pentagon sources.

Gray, 58, has had a wide-ranging career during his 37 years in the corps, where he began as an artillery officer and was a commanding officer in the Vietnam war during evacuation operations in Southeast Asia.

He also was in charge of developing the use of sensor technology for the service in 1969 and has been chief of the Intelligence and Reconnaissance Division at Quantico Marine Base, commander of the 3rd Marine Division on Okinawa and commanding general of the Atlantic Landing Force Training Command and the 4th Marine Amphibious Brigade.