Tame this creature in the day so it's slow once it's knocked out build around it so it will get stuck, because they will wake up at the start of a new night. Than knock it out again so it can't get you when it's powerful.
Useful tip for everyone: Ark’s day and night cycle is 1 hour in real life (on normal settings).
That means if you shoot the dinosaur right out at 8:30 p.m., it will wake up in real time in one hour at 8:30 p.m. the next day. For each past hour you have to subtract 2 minutes and 30 seconds. Example: you knocked him out at 10:30 p.m. -> he will wake up in 60 minutes - 2,5 - 2,5 = 55 minutes
At level 26, it is the first time that the Megalosaurus needs more than an hour to be tamed.. So be prepared to knock him out twice or three times