You're playing with fire/pushing your luck.
If you expect to consider 2023 as︃ non taxable in Spain, you must:
1) Spend more than 183 days in Dubai, with︄ a residency permit, salary, YEARLY rental agreement, bills and provable expenses (Starbucks, grocery tickets, you︅ name it). Yeah, in theory you will become a tax resident under Dubai's eyes if︆ you spend 90 days, but this is still not confirmed and who the heck knows,︇ why risk it. Also, the fact that UAE considers you tax resident does not mean︈ Spain will, and in case of doubt that's when the DTT rules will kick in,︉ and since you will not be (ever) a UAE national, you will lose in that︊ tie-break. So you WILL need to spend the 183 days and, to be honest, why︋ risk it. Spend 200+ days.
2) You can't just move out. You need to log︌ out from Hacienda by filing the proper documentation, and when youre in UAE you should︍ register in the consulate asap.
The trick of spending a few days in UAE, getting︎ the TRC and then going to Portugal will not work during the first year, that️ is for sure. They will challenge. Of course, this could happen maybe 5 years after you've moved back to Spain, after you've shown them the modelo 720 (if you decide to keep your money outside the country, which is probably a good idea in the first place, do NOT bring the money back into the country, not ever).
Anyway, basically doing what you're projecting you're heading straight into a cliff. Hacienda can afford missing, but you can not miss once. If they challenge and you don't have all your s**t in order, you're done for.
3) I am of course assuming you have no vital︀ interests or wife/kids in Spain. Wife and kids WILL have to relocate with you (or︁ you can divorce, at least on paper), and if you have company/ies you WILL have︂ to appoint someone else as director and just stay as shareholder, preferably let someone buy︃ into your shares, or it will be very hard to cut ties. If you have︄ real estate, you must rent it all out or else it could be considered as︅ your main residence. If the booty is worth hunting, they will hang on to any︆ of these ridiculous things just to f you over.
4) My suggestion is to go︇ out of Spain, and never come back until you absolutely retire or can, for example,︈ take all in crypto only.
And last quesiton, what's your estimated profit per year? As︉ I do read a few people obsessing about relocating but the overall money doesn't really︊ pay off the whole operation.