With the approval of the court a defendant may enter a conditional plea of guilty, reserving in writing the right, on appeal from the judgment, to review of the adverse determination of any specified trial or pretrial motion. A defendant shall be allowed to withdraw such plea upon prevailing on appeal.
Ky. R. Crim. P. RCr 8.09