Tanzania is culturally conservative, so keep your knees and shoulders covered when in public, regardless of your gender. Loose-fitting clothes in a fabric that won’t overheat you, such as linen, silk, and cotton, will be your friends.
The Tanzanian people are generally accepting of female tourists who wear trousers if they’re baggy and don’t hug the figure too much.
If you visit Zanzibar, chances are, you may want to spend time on the beach. It’s a particularly conservative, Islamic part of Tanzania and you’ll need to be careful not to give offence with your clothing choices during Ramadan. While you can usually wear your standard beachwear outfit of choice to swim in (though the more it covers, the less likely you are to encounter difficulties), you’ll need to cover up as soon as you hit the streets and shops again. Even on the beach itself, women are advised to wear a sarong or kaftan.