The nearest station is in the village of Hope, which is four miles along the road from Castleton. Hope station is on the Manchester to Sheffield line and is served by an amazing one train every two hours. Once you get to Hope, it's probably best to get the bus to Castleton. These run roughly once a hour, with the occasional two hour gap to make things interesting.
Being in the middle of nowhere, it's probably best if you travel by car. The Peak District has good road links and is reasonably accessible from most of the UK. To our International guests, to avoid the unpleasent surprise of learning that British public transport is there to serve the share holders and not the general public, you're best advised to hire a car at the airport.