Are you serious?
The anthem isn't "Anchor's Away" for no reason ...
Yes, you can attend the Naval Academy and not serve on a ship. Its' called selecting the Marine Corps option.
Generally speaking, Marines do not like being on board ships either. As a Marine Officer you get to spend a lot of time outdoors, communing with nature. You and you fellow Marines get to enjoy many leisurely strolls through some of the true gardens spots of the world. Every night just before they tuck you into your bed they serve warm cookies and milk too!