Preheat your oven to 375°F (190°C). Apply a thin coat of cooking spray or butter to a baking dish, and keep it aside.
Cookthe macaroni or pasta according to the package instructions until al dente.Drain and set aside.
Heat the butter in a large saucepan over medium heat until it melts. Add the flour and whisk continuously for about 1-2 minutes until a smooth roux forms.
Slowly add the milk to the mixture while whisking continuously to prevent lumps from forming. Continue cooking and stirring until the sauce thickens and becomes smooth, about 5 minutes.
Reduce the heat to low. Add the shredded cheddar, mozzarella, and grated Parmesan cheese to the sauce, stirring until all the cheese has melted and the sauce is creamy and well combined.
Stir in the prepared basil pesto and garlic powder, ensuring the pesto is evenly distributed throughout the sauce.
Adjust the seasoning of the sauce with salt and pepper according to your taste preferences.
Add the cooked pasta to the cheese and pesto sauce, stirring gently until all the pasta is coated evenly.
If desired, spread the breadcrumbs over the top of the mac and cheese in the greased baking dish.
Bake the mac and cheese in the preheated oven for 25-30 minutes or until the top is golden and bubbling.
Once done, remove from the oven and let it cool for a few minutes before serving.