Virtual network embedding (VNE) is an effective approach to solve the resource allocation problem in IoT networks. But most existing VNE methods are centralized methods, they not only impose an excessive burden on the central server but also result in significant communication overhead. Therefore, this paper proposes a distributed resource allocation method based on federated learning (DRAM-FL) to alleviate the computing and communication overhead, and improve network resource utilization. When utilizing DRAM-FL, it is essential to address the security challenges arising from the unreliable nature of IoT devices. So, we introduce blockchain into DRAM-FL, and propose a distributed resource allocation method based on blockchain and federated learning (DRAM-BFL). In DRAM-BFL, a dual-chain structure is designed to facilitate reliable information exchange among nodes, a node reliability assessment method and EPBFT-NRA consensus algorithm are proposed to improve the security of VNE. Simulation results demonstrate that, compared with other methods, DRAM-BFL can increase the VN acceptance rate and long-term average revenue-to-expenditure ratio while improving system security. In addition, DRAM-BFL exhibits good scalability, and has superior throughput and delay performance in IoT with malicious nodes.