Bunker fuel oil, one of the products of petroleum refining, has a strong impact on the production process because it drives the availability of heavy residues that depend on the crude quality. Based on the uncertainty of its demand, a stochastic model is proposed, where the benefit of the production is optimized, taking decision on the more suitable raw material, intermediate products and its final blend in order to fulfill the quality and demand requirements of final products. Three different crude qualities are supposed to be available for the first stage decision and their prices include an estimation of the storage cost for different scenarios. The optimum implies the most expensive quality to be bought due to a lack of incentive in the production of extra amounts of fuel oil at a non attractive price. Results are compared with the solution of a deterministic model with mean demand. In spite of being more complex than the deterministic model, the stochastic model solution's shows how the refinery should operate for each scenario of bunker fuel oil demand. Relative value between raw material and products, storage cost and some constraints in the demand have strong impact in the solution. Finally, a first approach to a procedure for building a stochastic model for linear programming packages, of common use in the refining industry, is exposed.