After you do the upgrade, Windows will assign the new product key to the installation. Instead, you'll have to install Windows 8, then do a free upgrade to 8.1. And the product keys are different for Windows 8 and 8.1, so if you have a Windows 8 product key, you can't just use it to install Windows 8.1.
One caveat you should be aware of up front is that you can no longer download an ISO for Windows 8-just 8.1. Related: Where to Download Windows 11 ISO Images Legally The process for using the tool is largely the same for both versions of Windows, so we'll be using the Windows 10 Media Creation Tool for our example. If you've got access to a Windows machine, the official method for downloading ISOs for Windows 8.1 and 10 is the Media Creation Tool. Download the Windows 10 or 8.1 ISO Using the Media Creation Tool
The most important thing is that you have a valid license key. If it won't activate, you can always install and then call Microsoft to get them to straighten it out and allow your copy to activate. Depending on the OEM version of Windows that you are running, you might run into an issue using the OEM key with a retail version of Windows.