To make the cheese sauce, simmer milk, garlic and bay leaf gently until garlic is tender. Remove garlic and bay leaf. Smash garlic to a paste and add back to milk. Cook butter and flour over low heat, stirring often for 10 to 15 minutes to make a roux. Whisk or blend roux into the milk mixture and bring to a low simmer for 20 minutes. Use a heavy bottom stainless steel pot, (not aluminum) and be mindful not to let the bottom scorch.
Preheat oven to 325° F. To assemble gratin: Coat 8×12 inch baking dish with butter. In a bowl, toss sliced potatoes and squash with salt to and let sit for 5-10 minutes. With a clean towel, pat dry the salted potatoes and squash, then taste the raw potato for seasoning. Adjust seasoning if necessary. Combine potato mixture, apples, leek with 3 cups of the cheese sauce in a bowl and toss to coat evenly. If it seems a bit dry add more sauce to coat. Pack the mixture into the baking dish and gently press it down to so you have a smooth surface. Top with reserved comte cheese and some fresh thyme leaves. Bake for 45 minutes, or until golden brown on top and tender when pierced with a knife.
Serves 6 to 8