It is absolutely ethical for you to try to get the best deal. That’s not what you need to worry about. That company knows and expects that you need to look after yourself first.
What you need to worry about: How do you achieve your goal of getting the best possible offer, and if that fails, not losing the second best offer?
You go to company B first and tell them that you have an offer in the table from another company, that you prefer company B, but that you need a decision soon because you don’t want to lose out if they decide against you. Then you see how they react. They might say “ok, we move the interview to tomorrow and the day after that we will make you a job offer, or we won’t”. Or they say “we will make a decision in about six weeks, and there is no way to speed this up”. No answer means they will take a long time.
With that information you go back to A. If they refuse to wait three days, that’s a big red flag. But if you asked them to wait six weeks, they’d likely ask you to decide now (or in a few days). So you go to A and tell them that you expect another offer, and in which time frame, and see their reaction.
Some highly irrational people will be insulted that you dared looking elsewhere and retract their offer. In that case, you had a narrow escape. Starting with a company like that would have been a mistake. What will most likely happen is that the company will tell you when they need your decision. It depends on their situation obviously. When do they need you? Did they have another suitable candidate?
It’s one of the more stressful things in life. My last interview time, there were four companies, one didn’t like me (enough), one I didn’t like at all, one was too slow so I’m working for the fourth one.