I have worked in Algeria for some time, where there is a young foreign female pilot working for an air carrier there, flying a bush plane. She tells me she has never had any worries for her security whatsoever, but sometimes gets treated poorly by older or less educated men who feel threatened by seeing a young female in such a 'senior' occupation.
Tunisia is very much a tourist destination for Europeans. I cannot imagine that you would have any difficulty there, my experience passing through Tunisia many times (moving aircraft, not on a bike) is that the Tunisians are very gracious, tolerant and polite people.
Morocco I am not familiar with.
Overall suggestion - you probably know this anyway - understand the local customs, and take pains to appear 'professional'. For example, in Algeria, it gives offence if men wear shorts, so we never do. As a woman, you would need to dress conservatively, but no more conservatively than you would when visiting a cathedral in Italy, for example.
Also, you would want to avoid places where you would be the one foreign person in a large crowd of uneducated local people (e.g. a bar), and stick to better quality lodging, or places that cater to European visitors and thus would not consider you to be anything out of the ordinary.
What dates are you planning to go to Tunisia? I am in Switzerland now, and hope to go through Tunisia later this summer, on my way to Libya.