Preheat oven to 350 degrees. Spray generously with non stick spray or coat with butter.
Prepare the potatoes, ham, onions and set aside.
In a large sauce pot, melt the butter over medium heat. Whisk in the flour and brown mustard. Stir and cook until smooth and bubbly, about 3 minutes.
Gradually stir in the milk, whisking constantly until smooth. Stir in the salt and pepper. Heat to a low boil, and remove from heat.
Slowly add in ¾ cup of the smoked gouda and ¾ cup of the New York cheddar. Stir until the cheese has melted and the sauce is smooth.
In the prepared baking dish, arrange half of the potatoes, ham and onion. Cover with half of the cheese sauce. Repeat the layers of potatoes, ham, onion and cheese sauce.
Sprinkle the top with the remaining cheese. Cover with foil and bake for 1 - ½ hours until the potatoes are tender and cooked through.
Remove foil and broil for 3 - 4 minutes until the top of the cheese is browned and bubbly.