Preheat oven to 200 degrees C. Lightly grease a glass or ceramic baking dish.
Mix grated cheese, rosemary and garlic together in a bowl.
Slice 3 or 4 potatoes using a mandoline on the thinnest setting. Slice remaining potatoes using a slightly thicker setting on the mandoline.
Line the bottom of the prepared baking dish with thin potato slices, overlapping them to create a layer that is 2 to 3 slices deep. Stand remaining thin slices along the sides of the baking dish so that they just stick over the rim, overlapping them to create a layer that is 4 slices deep.
Spread 1/3 of the thicker potato slices in the baking dish. Sprinkle 1/3 of the Parmesan cheese mixture on top. Repeat once more. Arrange remaining potato slices in the baking dish. Reserve 1/3 of the Parmesan cheese mixture.
Melt butter in a saucepan over medium heat; whisk in flour. Pour in milk; cook, stirring occasionally, until sauce thickens, 5 to 6 minutes. Stir in salt.
Shift potato slices in a few places with a knife to create wells for the sauce to flow through. Pour sauce evenly over potato slices in the baking dish. Sprinkle remaining 1/3 of the Parmesan cheese mixture on top. Brush potato edges sticking out of the baking dish with olive oil.
Bake in the preheated oven until potatoes are soft and edges are crusted, 60 to 75 minutes.