The Flathead Tunnel is a 7.01-mile (11.28 km) railroad tunnel in the Rocky Mountains of northwest Montana near Trego, approximately 28 miles (45 km) west of Whitefish. Located on the BNSF Kootenai River Subdivision, it is the second-longest railroad tunnel in the United States .