The best advice is in the comments, don’t let an officer search your car. Extremely smart advice and they give the reasons why in the comments too.
What if some valet or mechanic smoked a joint in your car, or a marijuana seed or flake of cocaine fell out of his pocket in your car? What if they are looking for a suspect with a blunt instrument murder weapon and you have something in your car that matches?
Always something to consider if purchasing a used vehicle. Especially if you plan any border crossings.
So, you say "no", and they they tow your car to search at the police station. You haven't won anything.
Doesn't work. In my younger years, I got stopped numerous times and cops searched my car. Protesting didn't help. And twice, cops stole personal items from my car. Complaints to the police department had no effect. When they didn't find any contraband, I was given speeding tickets even though I wasn't speeding. Later, I worked with cops and understood that they are not doing the job to serve the public.