The Industrial Internet of Things (IIoT) enables industries to build large interconnected systems utilizing various technologies that require high data rates. Terahertz (THz) communication is envisioned as a candidate technology for achieving data rates of several terabits-per-second (Tbps). Despite this, establishing a reliable communication link at THz frequencies remains a challenge due to high pathloss and molecular absorption. To overcome these limitations, this paper proposes using intelligent reconfigurable surfaces (IRSs) with THz communications to enable future smart factories for the IIoT. In this paper, we formulate the power allocation and joint IIoT device and IRS association (JIIA) problem, which is a mixed-integer nonlinear programming (MINLP) problem. {Furthermore, the JIIA problem aims to maximize the sum rate with imperfect channel state information (CSI).} To address this non-deterministic polynomial-time hard (NP-hard) problem, we decompose the problem into multiple sub-problems, which we solve iteratively. Specifically, we propose a Gale-Shapley algorithm-based JIIA solution to obtain stable matching between uplink and downlink IRSs. {We validate the proposed solution by comparing the Gale-Shapley-based JIIA algorithm with exhaustive search (ES), greedy search (GS), and random association (RA) with imperfect CSI.} The complexity analysis shows that our algorithm is more efficient than the ES.