A police officer comes to the door and tells you that he needs to come inside and have a look around. It’s your house, but you suddenly feel like you just have to do whatever the officer orders you to do. The police are in authority, after all. Do you have to allow that search?
You don’t.
While being a police officer does put that officer in a position of authority, that does not apply to your home. The officer has no right to come inside. You can refuse to allow the search. They can try to convince you otherwise, but they can’t force their way in, arrest you, threaten you with legal action or anything along those lines. You are well within your rights to tell them that they cannot come into your house, and then you can simply close the door.
There are, of course, exceptions to this rule. For instance, if the officer sees something in plain sight, they can sometimes use that as an excuse to enter the home, perhaps believing that a crime is in process or that evidence is going to be destroyed. They can also get a search warrant. That warrant overrides your wishes and they can enter the home with it regardless of what you say. However, they have to get the warrant first, and you should ask them to see it if they claim that they have one.
Situations like this can get complex and may feel very intimidating. Be sure you know both your rights and all of the legal defense options you have.