In the United States, a police officer may search a car without a warrant by invoking a probable cause, such as "I smell illegal drug X in your car"? Assuming the police officer made it up and that there exist no recording of the police officer admitting he lied, how to challenge in court such a claim?
In the heat of the moment there is nothing you can do. You can very likely sue them later if the search shows up empty or if they infringed your rights.
In order to actually make the claim you'd either need a history of previous searches based on officer's suspicions that all showed up empty (thus indicating a pattern of harassment against you, and abuse of powers by the officer) or you'd need to find out if that same officer has done other searches based on their 'gut instincts' and constantly coming up empty (therefore establishing a pattern of this particular officer doing this regularly in infringe on citizens rights).
If an officer pulls you over for a traffic stop and performs the search (even if it's illegal), take video of it and make them aware you have not consented to a search. You are allowed to film the police in execution of their duties. No, this isn't considered a private matter and anyone who thinks it classes as private is out of their mind. You might not be able to stop the search, but you can take action against them later. I cannot stress this enough but do not try to stop them. This will only end badly for you.
EDIT: For clarification, I am British. The same concept applies in the US but the charges you can hold against an offer may vary in the states