Preheat oven to 400°F (200°C). Cut spaghetti squash in half lengthwise, scoop out seeds, drizzle cut sides with 1 tablespoon olive oil, and season with salt and pepper.
Place squash cut side down on a baking sheet and roast for 35-45 minutes until tender. Let cool for 10 minutes, then scrape flesh into strands with a fork and transfer to a large bowl.
While squash roasts, heat remaining 1 tablespoon olive oil in a large skillet over medium heat. Cook onion for 3-4 minutes until softened, then add garlic and cook for 30 seconds until fragrant.
Add ground beef to the skillet, breaking it up as it cooks. Cook for 6-8 minutes until no pink remains and internal temperature reaches 160°F (71°C). Drain excess fat.
Stir in marinara sauce, diced tomatoes, Italian seasoning, red pepper flakes, salt, and pepper. Reduce heat to low and simmer for 10 minutes until slightly thickened.
Reduce oven temperature to 375°F (190°C). In the bowl with shredded squash, combine half the meat sauce, ricotta, and half the Parmesan. Stir until evenly combined.
Grease a 9x13 inch baking dish. Spread the squash mixture evenly in the dish. Top with remaining meat sauce, then sprinkle with mozzarella and remaining Parmesan.
Cover tightly with foil and bake for 20 minutes. Remove foil and bake for 15-20 minutes more until cheese is melted and golden in spots and sauce is bubbling.
Let rest for 10 minutes before serving. Garnish with fresh basil and parsley.