How do I calculate the cost per usage of a machine? If you buy a machine for 10.000 dollars, which costs as a yearly write-off 2000 dollars, how do I calculate the cost per usage of a machine? Do you just divide the the yearly write-off by the times you use it per year? Or do you divide the yearly write-off by the times you potentially could use it per year? 
How do you take into account the wear and tear/loss of value of using it? 
Or is there some other way?

The machine is used in diagnostic medicine. I'm trying to calculate how much 1 test costs.

Is it just 2000/(Number of times used per year)?
Correct approach: there is reliable information (from the vendor and/or from past experience), that the machine can perform $T$ number of tests in total before being scrapped or taken out of service. Then the cost of the machine per se allocated to the execution of one test is $10.000 / T$.

In the OP's case, a straight-line depreciation method is applied, writing-off $2.000$ per year. The problem here in the calculation $2.000/T_i$ for year $i$, is that next year, if the number of tests is more/less, one will get a different cost allocation of the value of the machine on a single test -and it will be misleading. So for economic-costing purposes this is not advised. But for purposes of reconciliation with accounting practice year-by-year, then one could accept the artificial variation, if one cannot apply the correct approach.

A mitigating approach, if historical data exist, is to take "average yearly tests performed", and divide $2.000$ with this average.