Fog computing is emerging as a promising mode to meet the stringent requirement of low latency in industrial Internet of Things (IIoT). By dynamically offloading part of the computation-intensive tasks from a fog node to a cloud server, the computation experience of users can be further improved in fog computing systems. In this paper, we develop an energy-optimal dynamic computation offloading scheme (EDCO) for IIoT in a fog computing scenario. The purpose is to minimize energy consumption when computation tasks are accomplished within a desired energy overhead and delay. Specifically, we first formulate an energy minimization computation offloading problem with delay, energy and other network resource constraints. To address this optimization problem, an accelerated gradient algorithm with joint optimization of the offloading ratio and transmission time is proposed; it can find the optimal value with a fast speed that improves the convergence speed of traditional methods. Subsequently, to better meet the stringent energy and latency requirements of IIoT applications, the dynamic voltage scaling (DVS) technique is integrated into the above solution, and we develop an alternating minimization algorithm to achieve energy-optimal fog computation offloading by jointly optimizing the offloading ratio, transmission power, local CPU computation speed and transmission time. Finally, the numerical results reveal that the proposed offloading scheme is superior to the local computing, full offloading and partial offloading with fixed computation speed schemes in terms of energy consumption and completion time. We also confirm the convergence rate advantage of the accelerated algorithm.