The former Scotland international has had a Midas touch at Recreation Park.
Appointed in May 2011, Hartley led Alloa to the Third Division title the following year and then promotion to the First Division – now the Championship – via the play-offs last May, and the Wasps made a fine start to this season.
They sat in fourth place at Christmas after a 2-0 win over Morton which came in the wake of Hartley being unsuccessful in an interview for the manager’s job at Inverness Caledonian Thistle.
Since then Hartley’s side have slipped to eighth place on the back of four defeats in five games and Hartley quit as he felt that he has got all he can from the players.
A board spokesperson at Recreation Park said: “We are both surprised and extremely disappointed at Paul’s decision. He has been tremendously successful here, however he feels that his time is at an end. We know how determined a person he is so there is little chance of changing his mind.
“Everyone involved at the club has enjoyed working with Paul and he has done a tremendous job here.”
Hartley said his resignation was not related to the heavy defeat at the hands of Dumbarton.
“The decision is nothing to do with getting beaten 5-1 because I have had bad results in my two and a half years here,” he told the Alloa Advertiser.
“But I just felt that, over the past few weeks, my time at the club was up and our journey together has come to a natural end. I think it is time for someone else to come in and regenerate the players again.
“I have had a great two and a half years here but it wasn’t a split- second decision, it is something I have been mulling over for the past few weeks and I feel it is the right thing to do.”
Assistant manager Paddy Connelly will take charge of the club in the interim as the hunt begins for Hartley’s successor.