When John McCain is buried in the U.S. Naval Academy Cemetery on Sunday, he will rest one row from the graves of Midshipmen William Edward Neumann and Thomas Ward Jr., who were killed in a turret blast on the battleship USS Missouri in 1904.

Nearby is the tombstone of Marine Lt. Col. David Kerr Claude, who was killed in the Battle of Tarawa in World War II after diving into the ocean to rescue wounded comrades in danger of drowning.

And not far away is the ornate stone sarcophagus of the Union Navy officer William Cushing, who during the Civil War sank a huge Confederate ironclad with an explosive rigged to the end of a long pole.

While McCain is being buried beside his friend and Naval Academy classmate Adm. Charles R. Larson, the late U.S. senator and Vietnam POW will rest amid many Navy heroes with their own ties to the academy.

The small cemetery occupies about 6.7 acres on a grassy hill at Hospital Point where College Creek meets the Severn River in ­Annapolis.

The cemetery dates to 1869, said James Cheevers, the retired curator at the Naval Academy Museum, and is rich with Navy lore and the echoes of great deeds and misdeeds. Graduates choose to be buried there because of strong emotional ties to the academy, he said in an interview Tuesday.

“Most of them hate it while they’re here,” he said. “And then when they get away, they think, ‘That wasn’t so bad. I had a lot of great fun.’ ”

Many of the aged stones bear weathered nautical motifs of anchors, ropes and chains. The stone of Capt. Robert Alfred Theobald Jr. has the image of the destroyer USS John W. Weeks, which he commanded during World War II.

And the footstone at the grave of Chief Gunner’s Mate Henry Lynde is inscribed “USS Santee.” On Oct. 12, 1886, the Swedish immigrant died on the Santee, an old Civil War frigate that had been stationed at the academy for years. As the crew fired a salute, one of the guns malfunctioned. A piece flew off and killed Lynde.

There’s a stone commemorating Rear Adm. Isaac Campbell Kidd, whose remains are still aboard the USS Arizona, which was sunk at Pearl Harbor on Dec. 7, 1941. And in a shady spot rests Adm. Husband Kimmel, who was in command of the Navy at Pearl Harbor that day and whose reputation was destroyed by the Japanese surprise attack.

The intrepid submarine skipper Eugene Fluckey, who was awarded the Medal of Honor, is in the cemetery columbarium.

McCain’s father and grandfather, both esteemed admirals, are buried in Arlington National Cemetery.

At the chapel service Sunday, McCain’s longtime friend Mark Salter is to read from Psalm 107: “They that go down to the sea in ships, that do business in great waters; These see the works of the Lord, and his wonders in the deep …”