The invention provides a calculation unloading and resource allocation method and device based on deep reinforcement learning, and the method comprises the steps: calculating the total calculation resources of an MEC server based on the calculation task parameters of UE, the performance parameters of the UE, the channel parameters between the UE and an AP, and the mobile edge, and constructing anoptimization problem model; and determining the optimal solution of the optimization problem model based on deep reinforcement learning, determining the unloading decision of the UE, and respectivelyallocating the percentage of the computing resources and the percentage of the spectrum resources to the UE. According to the calculation unloading and resource allocation method and device based on deep reinforcement learning provided by the invention, the actual calculation unloading and resource allocation characteristics in the time-varying MEC system are considered, the time delay threshold of the task and the limited resource capacity constraint of the system are based on deep reinforcement learning, the DNN is used for effectively approximating a value function in reinforcement learningso as to determine a joint optimal scheme of calculation unloading and resource allocation, and the energy consumption of the UE is further reduced.