He did not say when he would leave office but his party said a new premier would be sworn in on Wednesday.
The 80-year-old’s current wife, with whom he was living at the time of the murder, was charged in connection with the killing in February.
The pair have denied any involvement.
“I decided to personally come and inform you that I am stepping down as prime minister of Lesotho,” AFP news agency says he told supporters in his Abia home constituency on the outskirts of the capital Maseru.
Lesotho has been plagued by political instability this year – he lost his majority in parliament last week when the coalition backing him fell apart and a new government is expected to be installed on Friday.
What happened to Mr Thabane’s ex-wife?
Gunmen shot and killed Lipolelo Thabane on 14 June 2017 – two days before Mr Thabane was sworn in as prime minister.
While returning home, she was ambushed, shot several times at close range and died on the side of a dirt road. She was 58.
At the time, Lipolelo was going through a bitter divorce with Mr Thabane and had been living apart from her husband since 2012.
He had moved in with a new woman, Maesaiah Thabane, some time between 2012 and 2017.
Mr Thabane appeared in court in February for acting in “common purpose” but he hasn’t been formally charged yet.