There will be no explosion. The reason is that the dynamite also rides on the pole. Hence, it’s clocks are same as the pole’s. Therefore, the machinery which sees that whether the pole has fit inside the barn or not, will notice that both the ends of the pole were not inside the barn simultaneously.