Luke pwns
Remember what Obi-wan did to that crazy spikey leg thing in AOTC. Luke does that to the rancor.
Rancors are pretty slow. And they're skin isnt resistant to sabers. ANY animal that isnt fast enough to kill someone instantly (before they can react) or does not have a hide thick enough to stop a saber will get pwned by a lightsaber.
All luke has to do is chop a leg off and then when the rancor falls over just slice it in the face.
Not hard. Even without the force.