Cut the spaghetti squash in half lengthwise and scoop out the seeds. Drizzle a little olive oil and sprinkle salt and pepper on the inside of the squash.
Place the inner side of the squash facing up on the trivet inside the Instant Pot. Add 1 cup of water to the bottom of the pot. Close the lid, ensuring the pressure valve is set to sealing.
Select the 'Manual' or 'Pressure Cook' setting and set the timer for 7 minutes on high pressure. Once done, allow the pressure to naturally release for 10 minutes, then carefully switch the valve to venting to release any remaining steam. Remove the spaghetti squash and set aside to cool slightly.
While the squash is cooling, turn the Instant Pot to the 'Sauté' function. Add the olive oil and diced onions. Sauté for about 3-4 minutes until the onions are translucent.
Add the minced garlic and mushrooms to the pot. Cook for an additional 5-6 minutes, stirring occasionally until the mushrooms are tender and browned.
Pour in the crushed tomatoes, dried oregano, and dried basil. Season with salt and pepper to taste. Let the mixture simmer for about 5 minutes while stirring occasionally to allow the flavors to meld.
Once the spaghetti squash is cool enough to handle, use a fork to scrape out the flesh into strands.
Divide the spaghetti squash strands onto plates and top with the mushroom ragu. Garnish with fresh basil if desired.