Your best option is to seek help from an attorney in your area on the matter to help put the case in perspective for the prosecutor.  If this is really a retaliatory issue between you and your ex then that matter has to be brought to light.  Just by your saying it does not make it true.  You can make the accusations as to the issue with the drugs but it is unlikely that the Judge would order the testing done on the complaining witness absent EXTREME circumstances.  And your actions may have - from the outside - appeared to be warranting of the charge.  The entire set of circumstances needs to be revealed.  Good luck.