If you prefer flying, then you should book your flight tickets to Bhuntar Airport, serving Kullu and Manali. It is located around 30 km from Kasol. However, if you're coming by train, then the nearest railway station is Pathankot for broad gauge rail, and Joginder Nagar for narrow gauge. From these places, you can take a bus or taxi to reach Kasol.
Additionally, you can even catch a bus from most major cities of North India to Kasol. There are state as well as privately run bus services plying to Kasol and the bus ride is adventurous and highly recommended.