Mehdorn, 66, made the announcement during a press conference in Berlin and said he was not to blame in the controversy, maintaining that monitoring emails sent to and from the company was not illegal.
"I have offered my resignation to the president of the supervisory board," Mehdorn told reporters, adding: "I assume that a successor will be appointed before the summer holidays."
Mehdorn has come under increasing political pressure to step down as more details emerged in the scandal.
In recent weeks the company acknowledged that some investigative operations had taken place in 2002-2003. Mehdorn told workers in a letter he had made "mistakes," but insisted his actions were meant to root out corruption and were irreproachable from a legal point of view.
In an interview with Bild am Sonntag over the weekend Mehdorn accused critics of politically motivated attacks and said he shouldn't step down because the rail service had become “more punctual, cleaner and friendlier” under his decade-long tenure.