Grease a large baking pan using cooking spray. Line it with baking paper, ensuring the paper extends 2cm above the edges on all sides.
Prepare the macaroni by cooking it until tender. Once cooked, drain and allow it to cool.
In a frying pan, heat the oil. Sauté the onion, garlic, thyme, and bacon bits until the onion softens.
Add the grated baby marrow and sweet potato. Cook until the sweet potato softens, then transfer the mixture to a large bowl.
In the same bowl, combine the cooked pasta, whole wheat flour, mayonnaise and half of the grated cheese. Season with salt and pepper to taste.
Pour the mixture into the prepared pan and sprinkle the remaining cheese on top. Bake for 30-35 minutes or until the dish turns golden and becomes firm.