Yes it's possible, but you'd have to have an early start...you're looking at what, 90 mins to Tarifa from there?, that's 3 hours out of your round trip day already.
The fast ferry from Tarifa is 45 mins....the signs say 35, but its 45, so that's another hour and a half.......
Add an hour for getting through the border as a first timer, and you're not left with much of a day....Tanger itself is a nasty place, unless you're a fairly seasoned traveller...the closest place that I'd say is well worth a proper visit from there is probably Chefchaouen, and that's 2 hours from Tangers.
Make it an overnighter and it's a cracking idea, and I'd be happy to send you a few hotel details, routes etc, but as a day trip, I'd go to Ronda and then back on a different route if I were you, and save popping your Moroccan cherry for when you have more time to enjoy it properly
EDIT...PS ferry for solo bike and rider about £80 return.
Check your insurance covers you in Morocco, its unlikely, so on top if not, add £20 for insurance at the border.