Due to the time-varying characteristics of energy harvesting sources, it is a challenge for energy harvesting to provide stable energy output. In this paper, the time fair energy allocation (TFEA) problem is investigated, and an utility maximization framework is proposed to guarantee both time fairness and energy efficiency of energy allocation. Then we propose a prediction based energy allocation scheme. First, a deep learning predictor is used to predict the harvested energy. Second, we transform the TFEA problem into an Euclidean shortest path problem and propose a fast time fair energy allocation algorithm (FTF) based on inflection points search. Our algorithm can significantly decrease the iteration number of the shortest path search and reduce the computation time. In addition, we propose an edge computing assisted energy allocation framework, in which the computing tasks are offloaded to edge gateways. The proposed scheme is evaluated in the scenario of metro vehicles health monitoring. Experiment results show that the time consumption of FTF is at least 92.2% lower than traditional algorithms, while the time fairness of FTF is the best. The total time cost and energy cost of our edge computing scheme is also competitive compared with traditional local computing schemes.