You can access the droplet via the DigitalOcean console from your account and then disable UFW from there.
The Droplet console provides out-of-band access and is available regardless of your network settings. It emulates the access you would have if you were sitting down with a keyboard and monitor attached to the actual server. You can use this feature to log in and revert bad settings to regain normal access.
You can check this article - How to Regain Access to Droplets using the DigitalOcean Droplet Console
If you decide you don’t want to use UFW, you can disable it with this command:
Any rules that you created with UFW will no longer be active. You can always run
sudo ufw enable if you need to activate it later.
If you already have UFW rules configured but you decide that you want to start over, you can use the reset command:
Hope that this helps!