You have a few different defenses you can use in court to fight drug charges against you, but one of the strongest options is illegal search and seizure. 

The U.S. Constitution affords you certain rights when it comes to searches done by law enforcement. According to Cornell Law School, the Fourth Amendment gives you the right to be secure in your person, home and other effects. If law enforcement violated this right during your arrest, you could have a valid defense. 

The Fourth Amendment

Specifically, the Fourth Amendment says that courts cannot issues warrants without probable cause and that law enforcement officers cannot conduct searches without probable cause. This means that the officer would have to have a good reason to believe that you had drugs in your possession. 

Proof in court

History shows that for a court to agree to a violation of your Fourth Amendment rights, you must show that law enforcement invaded your privacy without reason. Many searches done without a warrant are not legally sound, except in the case where an officer arrests you prior to the search. 

Do note that if you agreed to a search, then you cannot claim a rights violation. Also, if you were a danger to yourself or others and this led to the need to conduct a search right away, then that also would not likely allow you to claim a violation of your rights. If law enforcement had reason to believe you would try to flee, this is also valid grounds for a search without a warrant. 

Finally, if an officer discovers drugs in your automobile or home because they were out in the open, then this also does not require a warrant, and it will be difficult to show the officer violated your privacy rights.