Yes male officers are allowed to search female suspects. There are many times no female officers are available (they don't exactly stand around waiting for a call to go search somebodies suspect).
No officers can not simply randomly stop you and arrest you "for no reason". There was a reason, you just don't want to say.
If you want a truly honest answer to your questions on this forum, you need to tell the complete truth. I won't judge you, everybody makes mistakes. But if you lie, you will not receive a complete answer, and most likely get trolled.
Well now that you admit there were illegal drugs in the car the full story is starting to come out. I have no doubt there was furtive movement when you were pulled over, people hiding the drugs, people in the car high, etc.