The report proposes a step-by-step algorithm for solving the problem of distribution of investment resources in the network model of the megaproject. The megaproject is presented in the form of a directed graph without contours. The duration of each work of the network model is a random variable. Works of the network model are grouped in projects of economic agents participants of megaproject. Each agent has the directive term of the completion and also minimum and maximum admissible probability of completion of the projects in this time. The main task of resource allocation between projects is to increase the likelihood of their completion within a directive term frame with given initial volumes of investment resources of the megaproject. The algorithm is tested on the example of allocation of investment resources of PJSC Transneft by sections of Eastern Siberia-Pacific Ocean pipeline.