Cook the elbow macaroni in a large pot of salted water according to the package directions. Drain well and set aside.
In a medium saucepan, melt the butter over medium heat. Whisk in the flour and cook for one minute to form a roux.
Slowly whisk in the milk and continue cooking, stirring often, until the mixture thickens enough to coat the back of a spoon.
Remove the pan from the heat and stir in the shredded cheddar cheese until fully melted. Season with salt and pepper.
Add the drained macaroni, diced ham, and frozen peas to the cheese sauce. Stir gently over low heat until everything is warmed through and evenly coated.