no we can't claim unless the factory building was mainly constrcted for erection of plant and machinery.As per GST provisions ,input can be claimed only with respect to materials used in works contract resulting in plant and machinery and the plant and machinery is used for producing taxable supply.so here if you use any materials for constructing a factory building it is ineligible.