What does the Pontryagin index do in BPST instanton (solution to Yang-Mills theory)? $$
\mathcal L = -\frac12\mathrm{Tr}\ F_{\mu\nu}F^{\mu\nu}+i\bar\psi\gamma^\mu D_\mu\psi
$$
We take this Lagrangian for QCD, after this I need to calculate BPST instanton with topological Pontryagin index but I dont know how to do it well this will be the boundary conditions.
$$A_\mu(x + L, t) = A_\mu(x, t)\\
ψ(x + L, t) = −ψ(x, t)$$
with gauge field background $A_1(x, t) = A(t) + \alpha(x, t)$.
What Pontryagin index going to do in the instanton or which is the relationship?
 A: Your Lagrangian density describes a gauge theory, i.e. the dynamics of principal bundles (field configurations) with connection (gauge field) $A$ and curvature (field strength) $F = dA + A \land A$ on a four dimensional manifold $M$, e.g. space-time.
In mathematics there exists the concept of characteristic classes (Chern classes, Pontryagin classes, etc.) with which it is possible to classify field configurations of a gauge theory (see for example "Geometry, topology and physics" by M. Nakahara).
To deliver a short answer in your case we are interested in the second Chern class defined as
$$ C_2(F) = \frac{1}{8\pi^2} \text{Tr}(F \land F) \,.$$
We can express $\text{Tr}(F \land F)$ (also called Pontryagin density) as the total derivative of the Chern-Simons form $K$, i.e.
$$ \text{Tr}(F \land F) = dK $$
or in component expression
$$ \text{Tr}(F_{\mu\nu} \tilde{F}^{\mu\nu}) = \partial_\mu K^\mu $$
where $\tilde{F}_{\mu\nu} = \frac{1}{2} \varepsilon_{\mu\nu\lambda\rho} F^{\lambda\rho}$ denotes the dual field of $F_{\mu\nu}$.
It is straightforward to proof that
$$ K = \text{Tr}(F \land A - \frac{1}{3} A \land A \land A)$$
or in component expression
$$ K^\mu = \varepsilon^{\mu\nu\lambda\rho} \text{Tr}(F_{\nu\lambda} A_\rho - \frac{2}{3} A_\nu A_\lambda A_\rho) \,. $$
With the second Chern class it is possible to classify flat field configurations (fields with vanishing field strength) since the integral of the second Chern class over four dimensional space yields for any flat field configuration an integer $Q$ called winding number, Chern number, instanton number, Pontryagin index, etc. (it has many names). Fields that cannot be deformed under continuous deformations yield a different number $Q$, thus we can classify flat field configurations by $Q$.
Instantons are solutions that minimize the Euclidean action of the Lagrangian and describe a tunneling path between two classical vacuum states of your theory.
Here the classical vacuum states are given by field configurations that have vanishing field strength $F_{\mu\nu} = 0$. As described earlier, these are classified by the Pontryagin index $Q$.
Now let us suppose we want to describe the tunneling between the vacuum states corresponding to number $Q$ and $Q+1$, i.e. the index changes by $1$. The instanton that describes this process is called BPST instanton (and corresponds to instanton number $1$).
I can also recommend to read "Toward a theory of the strong interactions" by  Curtis G. Callan, Jr., Roger Dashen, and David J. Gross (https://journals.aps.org/prd/abstract/10.1103/PhysRevD.17.2717).
