In our opinion... the best time is right before the plane takes off and everyone is still boarding.
Look, unless you have bladders made of steel—and can hold it in for 15 hours in so—going on the airplane is going to be a fact of life. Not all flights can be 30 minutes.
The plane will have just been cleaned, that space is still virgin, and the cleaning products are practically in your nostrils. (Okay, maybe not, but at least 400 people haven't used the same 1x1 foot space yet.)
(That said: If you can also hold it in for 15 hours, or so, I'd strongly consult talking to a doctor or a send a note into the Guinness World Records.)
The second best time to use the bathroom on the plane is right after the service has concluded, but before the flight attendants have come around to clean up.
No one likes fighting the crowds and please, for the love of God, clean up after yourself.