Create file ~/.local/share/applications/deluge-magnet.desktop with next content.
[Desktop Entry]
Name=Deluge-Magnet
Exec=deluge-add-magnet.sh %u
Icon=insert-link
Type=Application
Terminal=false
MimeType=x-scheme-handler/magnet;
For KDE plasma run kbuildsycoca5 to create the cached resource file.
For a gnome desktop use 'xdg-mime' command.
Do not use the path only the name of the desktop file.
xdg-mime default deluge-magnet.desktop x-scheme-handler/magnet
Using xdg-mime can tell which application is bound to the passed mime.
xdg-mime query default x-scheme-handler/magnet