The rapid expansion of production of North American petroleum crude oil from shale has led to a significant increase in rail transport of crude oil. Broken rails are frequent causes of train accidents. Ultrasonic rail defect inspection is widely used to prevent train accidents caused by broken rails, thereby reducing the hazardous materials transportation risk. This paper describes a new methodology to estimate unit-train crude oil transportation risk by the frequency of location-specific rail defect inspection. The risk model was used to develop a Pareto optimization model that determines the frequency of segment-specific rail defect inspection to reduce the total-route risk in a cost-effective manner. A numerical case study was developed to illustrate the application of the risk analysis and optimization models. This research is intended to provide new methods and information to assist the railroad industry in optimizing investment in infrastructure improvement, thereby mitigating the risk of rail transport of crude oil and other hazardous materials.