We introduce the τ-function of a difference rational connection (d-connection) and its isomonodromy transformations. We show that in a continuous limit ourτ-function agrees with the Jimbo–Miwa–Ueno τ-function. We compute the τ-function for the isomonodromy transformations leading to difference Painlevé V and difference Painlevé VI equations. We prove that the gap probability for a wide class of discrete random matrix type models can be viewed as the τ-function for an associated d-connection.