You would be much better off swapping out for another EX500 engine with lower miles on it. By far the cheapest and easiest option. They can be had regularly for between $200-$400.
You can also rebuild the original engine, replacing all the worn out bearings, piston rings, valve seals, etc. However, that costs more. Between the bearings, rings and gaskets, it'll run you more than $600. I just finished a full rebuild on one and I don't recall the exact number, but my parts list for the engine alone was between $600 - $700 and that was with me cheating on a few parts as I had them in stock.
1990 EX500 - 142,000 miles as of August 12th, 2019
1993 Ducati 900SS - The real canyon carver
2002 EX500 - Undergoing a full restoration