In the 9th episode of series 15 of "Law and Order: SVU", a serial rapist offers to plead guilty to a rape which he did not commit, while refusing to plead guilty to a series of rapes which he actually did commit (the reasons for this are complex and irrelevant to the question).
The prosecutor and police seriously consider accepting his offer, even though they know he didn't commit the crime he wants to confess to, because they don't think they can prove the crimes he actually did commit. This doesn't sound to me like something which would be legal. Could a prosecutor really agree to a plea bargain deal which would involve the defendant confessing to something which the prosecutor knows they didn't do?
I know it's TV, but "Law and Order" has a reputation for being realistic TV.