If you tame an ichtyosaurus before, you can beat a Megalodon when you’re riding the ichtyo, he will not attack you back (even if he do you can escape easily)

More Megalodon Encountering Tips