Does a judge have to accept a plea bargain and give the defendant the sentence offered by the prosecution?

No, a judge does not have to accept a plea bargain reached between the prosecution and the defense. The U.S. Supreme Court wrote in Santobello v. New York that: There is, of course, no absolute right to have a guilty plea accepted. The Nevada Supreme Court explained in a recent case: Judicial power to reject plea bargains serves to modify and condition the absolute power of the prosecutor, consistent with the doctrine of separation of powers, by establishing a check on the abuse of prosecutorial (executive) prerogatives. However, as a matter of course, judges most of the time accept plea bargains. Courts ordinarily do not second-guess prosecutorial decisions in the plea-bargaining process.