You can probably disconnect the door ajar sensors from the tailgate… there is one on each side latch, and one for the rear window glass. Disabling the side latch sensors would probably solve the door ajar issue. I believe you would have to pigtail the sensor wires to disable the door ajar function. i do not recall ever being able to do this simply with a fuse removal.
I agree with
@donalds that the best solution here is to obtain a salvage hatch. The problem is the spot welds are broken, and the interior sheet metal that supports the hinges is almost surely bent. Getting your existing hatch to ever fit properly again will be quite difficult. it is difficult to discern the bending and damage, bit the hinges (in my experience) are not likely to be the issue.
My original hatch rusted from the inside, then snagged the truck upper roof line and was bent like yours. I tried to have a welder fix it, but the welder did not really put much effort or attention into the project, and it failed. Next, I got a salvage hatch that lacked structural integrity and was really no better. A lot of hatch work. Finally, I found a solid hatch and resolved the issue.
If you get a salvage hatch from a different model or year, you may need to swap out the wiring harness to solve odd electrical issues. You may also have to swap out the rear wiper motor because of wiring connector differences.
If you get the salvage hatch, look very carefully for fitment and any rust issues near the hinges... Many salvage vehicles have hatches that are not structurally sound because of rust and/or impact. I installed a salvage hatch that looked great, but lacked structural integrity. It was almost the same problem as my damaged hatch.
Becareful with model year changes, as the license plate mount changes from either on the rear bumper or on the hatch, and this could will cause more issues also. Or look quite odd.
When you remove the hatch, use an extension painting pole for support, or better yet get a few strong friends. The 97 hatch seemed particularly heavy! I even gave a homeless man $20 and something to eat to help me hang one of the hatches. That was maybe a little dicey, but better than having my lady friend get hurt trying to help.
As I recall, the preferred method was to leave the hinges bolted on to the tailgate/hatch during the swap. Then focus on the hardware and fasteners from the hinges to the truck roof.
If your replacement hatch is structurally solid, you will be surprised at how easy it is to line up.
I no longer drive around with lumber or material extended out the back of the truck with the hatch tied down.
Anyway, good luck with this.