Boil the spaghetti according to package instructions. Drain and drizzle with olive oil to prevent sticking. Set aside.
In a skillet, brown the ground beef or sausage over medium heat. Drain any excess fat. Add chopped onion and garlic, and sauté for 2-3 minutes until softened. Stir in marinara sauce and season with oregano, basil, salt, and pepper. Let simmer for 5-7 minutes.
In a large bowl, mix the cooked spaghetti with the meat sauce (or just marinara sauce if preferred). Stir in ricotta cheese until fully combined.
Lightly spray a baking dish that fits your air fryer with cooking spray. Add half of the spaghetti mixture to the dish, then top with half of the mozzarella and Parmesan cheeses. Repeat with the remaining spaghetti and cheeses.
Preheat your air fryer to 350°F (175°C). Place the baking dish in the air fryer basket and air fry for 10-12 minutes, until the cheese is melted, bubbly, and lightly golden.
Let the baked spaghetti cool for a few minutes before serving. Garnish with fresh parsley and enjoy!