First, even if your 2017 iMac could support TDM from an M1 Mac Mini (both of are far too new), the iMac would need to be in proper operating condition. It sounds like yours is not.
Therefore it behooves us to help you see if your iMac is user-fixable before sending you to the store. It may be. Sometimes the two components that make up the Fusion drive "lose contact" with each other and things slow badly. That can be fixed from your keyboard.
How to fix a split Fusion Drive - Apple Support
External SSDs:
Only an expensive Thunderbolt 3 external SSD will give that model with a Fusion drive a significant speed boost. The more common USB3 external SSD solution will be SLOWER than a healthy Fusion drive. The USB3 external SSD write/read speeds are capped at 400MB/sec. Remember that number.
Data: I have a small collection of drive performance scores from various iMacs; the SLOWEST Fusion drive in my database is this:
Performance:
System Load: 1.47 (1 min ago) 1.48 (5 min ago) 1.42 (15 min ago)
Nominal I/O speed: 3.54 MB/s
File system: 24.62 seconds
Write speed: 532 MB/s
Read speed: 1383 MB/s
This is more typical of the Fusions in 27-inch 5K iMacs of the period:
Performance:
System Load: 0.77 (1 min ago) 0.65 (5 min ago) 0.80 (15 min ago)
Nominal I/O speed: 0.58 MB/s
File system: 35.69 seconds
Write speed: 766 MB/s
Read speed: 2687 MB/s
What we need to be able to move you forward is to see your current drive, RAM, and software performance numbers. With those we can use data for recommendations rather than generalities—better all around! Fortunately there is a safe, secure way for your to do that.
We can quickly and within the limited confines of these forums help you determine what issues are at play if you use EtreCheck Pro, available here:
https://etrecheck.com/index
The free version will do nicely for this purpose, although the app is worthy of our financial support.
We can see hard data about drive performance, software issues, and RAM usage. Etrecheck is the development of a long-serving and trusted contributor here expressly for displaying information in these forums to help us help you. It will not reveal any personal or secure information.
Run it, select “Report" from the left-hand pane (scroll down to the bottom of that pane to find):
When its report displays, click the "Share Report" icon from EtreCheck’s toolbar and then "Copy report” from the resulting dropdown.
⚠️ Please DO NOT highlight the text in the report before using Etrecheck’s “Copy report” command—that will garble the formatting and make the report slower and harder to evaluate.
NOTE: Changes in late 2018 to the forum software require you use the “Additional Text" icon (see example below) to embed the report into a post:
Paste the report into the resulting “Additional Text” window: