No injuries were reported, said Marcie Katcher, a spokeswoman for the school, calling the 10:30 a.m. evacuation a "precaution."
National Grid worked to secure the leak, Katcher said, which has been stopped.
The Great Neck Alert Fire Company arrived on the scene also, along with the academy's security department, the school said.
As of 1 p.m. Wednesday, Katcher said, the midshipmen have been cleared to return to their barracks.
A 2010 federal report about facilities at the school detailed more than $300 million in needed renovations, replacement and rehabilitation projects.
Secretary of Transportation Ray LaHood in March 2012 announced construction plans for the academy, saying federal authorities needed to do a better job of maintaining and repairing facilities.
LaHood told reporters that $54 million in construction projects included replacing the aging Mallory Pier -- one of two piers enclosing the Hague Basin -- updating the 1940s-era mess hall and improving the academy's electrical system.
With Emily C. Dooley