Preheat your oven to 375°F (190°C).
Melt the butter in a heavy-bottomed saucepan over medium heat.
Whisk in the flour to create a roux, cooking for a minute until it’s golden.
Gradually add in the milk while whisking continuously to avoid lumps.
Bring the mixture to a simmer, adding salt and cayenne pepper until it thickens.
In your baking dish, layer half of the potatoes.
Pour half the sauce over them and sprinkle half the cheese.
Repeat the layers, covering the dish with aluminum foil.
Bake for 45 minutes. Remove the foil and bake for an additional 20-30 minutes until the top is golden and bubbly.
Let it sit for 10 minutes before serving.
