(Tensor5={{{1,0,0,0,0},{0,1,0,0,0},{0,0,1,0,0},{0,0,0,1,0},{0,0,0,0,1}},
{{0,1,0,0,0}, {0,d,0,0,0},{0,0,0,0,1},{0,1,0,0,0},{0,0,0,0,d}},
{{0,0,1,0,0},{0,0,0,1,0},{0,0,d,0,0},{0,0,0,d,0},{0,0,1,0,0}},
{{0,0,0,1,0},{0,0,0,d,0},{0,0,1,0,0},{0,0,0,1,0},{0,0,d,0,0}},
{{0,0,0,0,1},{0,1,0,0,0},{0,0,0,0,d},{0,d,0,0,0},{0,0,0,0,1}}});

MatrixForm/@Tensor5

SillyList20=DeleteCases[Flatten[Table[{i,j},{i,1,5},{j,1,5}],1],{a_,a_}]

SillyList25=Flatten[Table[{i,j},{i,1,5},{j,1,5}],1]

Table[{i,j},{i,1,5},{j,1,5}]

BasisToPairs20[n_]:=SillyList20[[n]]

BasisToPairs25[n_]:=SillyList25[[n]]

Tensor20=Table[(Tensor5[[BasisToPairs20[a][[1]], BasisToPairs20[b][[1]],BasisToPairs20[c][[1]]]]/.d->d1)*(Tensor5[[BasisToPairs20[a][[2]], BasisToPairs20[b][[2]],BasisToPairs20[c][[2]]]]/.d->d2),{a,1,20},{b,1,20},{c,1,20}]

Tensor25=Table[(Tensor5[[BasisToPairs25[a][[1]], BasisToPairs25[b][[1]],BasisToPairs25[c][[1]]]]/.d->d1)*(Tensor5[[BasisToPairs25[a][[2]], BasisToPairs25[b][[2]],BasisToPairs25[c][[2]]]]/.d->d2),{a,1,25},{b,1,25},{c,1,25}]

CheckAssociativity[Tensor_,x_,y_,z_,w_]:=CheckAssociativity[Tensor,x,y,z,w]=Sum[Tensor[[x,y,a]]*Tensor[[a,z,w]],{a,1,5}]==Sum[Tensor[[x,b,w]]*Tensor[[y,z,b]],{b,1,5}]

Union[Flatten[Table[CheckAssociativity[Tensor5,x,y,z,w],{x,1,5},{y,1,5},{z,1,5},{w,1,5}]]]

Union[Flatten[Table[CheckAssociativity[Tensor25,x,y,z,w],{x,1,25},{y,1,25},{z,1,25},{w,1,5}]]]