He says he has been informed that the Labour Party and the prime minister plan to use the waka-jumping legislation to remove him from Parliament six months before the next election, and decided to resign as an MP to ensure a by-election.
However, the prime minister rejected that.
Sharma announced the news of his resignation in a social media post this afternoon.
"I have sincere concerns that this underhanded move will mean people of Hamilton West will have no voice in Parliament for 6 months preceding the next General Election," he said.
In a statement as Labour's leader, Jacinda Ardern said the party's position on Sharma and the waka jumping provisions had not changed.
"We have not, and are not, considering invoking the waka jumping provisions, nor do I know the basis of Gaurav Sharma's speculation," she said.
"Gaurav may wish to reconsider his decision given he is unnecessarily costing the taxpayer hundreds of thousands of dollars to trigger a byelection he then intends to stand in.
"We consider it unnecessary and wasteful given the General Election is scheduled for 2023."