Surely an embarrassing loss is worse than dropping a case.
The DA can file the charges and drop the case right before (or even during) trial. No loss on their books