The cache allocation of in-network caching is fundamental to the quality of service in heterogeneous information centric network (ICN). The aim of the cache allocation is to efficiently allocate appropriate cache capacity to each router for storing content, avoiding the long-distance transmission cost from clients to servers. Existing works focus on the analysis of network topology. However, this way is computation-expensive for such analysis, at the same time it cannot reach a completely optimal network, due to its used multiple conflicting performance metrics. In this paper, we propose an ant colony inspired cache allocation mechanism (ACCM) for heterogeneous ICN, which is able to deal with the cache budget constraint. Specifically, we first construct an evaluation model of network performance, in terms of hit ratio, energy consumption, time latency, and throughput. Then, based on the evaluation model, we devise an ant colony inspired cache allocation mechanism, where the ICN topology system is mapped into an ant colony system and the cache allocation process is simulated by the ant colony foraging behavior. Our theoretical analysis shows that the proposed mechanism can converge to the best solution. Finally, we conduct simulations on AttMpls and TW Telecom topologies with real datasets in YouTube. Simulation results show the effectiveness and efficiency of the proposed mechanism on the simulation instances in terms of hit ratio, energy consumption, time latency, and throughput.