He made the announcement in a press conference in Milan on Tuesday, bringing down the curtain on a career that has yielded five wins in MotoGP and 22 victories in WSBK.
Melandri has endured a difficult WSBK season with the GRT Yamaha squad, which he joined this season after being replaced at Ducati by Alvaro Bautista.
He lies ninth in the standings with five rounds remaining, having finished third in the opening race of the year at Phillip Island and matching that result twice at Jerez.
The Italian endured a particularly torrid time at Donington Park last weekend, managing to score only eight points across three races.
Melandri last raced in MotoGP in 2015 with Aprilia, but parted ways with the Noale firm after eight races and did not race again until joining Ducati in WSBK in 2017.
He finished runner-up to Valentino Rossi in 2005 (pictured below) and also placed second in the WSBK standings with Yamaha in the 2011 season, which followed the end of his first stint in MotoGP.
Photo by: Gresini Racing