If a farmer had recently built a barn (within the past year) that cost
45,000 dollars (paid for from a loan), on a piece of property that was
originally 10,000 dollars(not paid for from a loan), but the market
only values the property with the barn at 35,000 dollars, is the
government only responsible for paying the market value if they decide
to seize this land through eminent domain?
Yes. The fact that you owe more on debt secured by condemned property than it is worth does not entitle you to more compensation, although the fact that the bank was recently willing to lend that much is strong evidence that its fair market value is more than the value of the loan, unless there was a corrupt or non-economic reason for it to make the loan.
United States v. Commodities Trading Corp. is concerned with situations where property is difficult to value (e.g. thinly traded derivatives contracts), or where property is not of a kind that derives its value primarily from market transactions (e.g. family photographs or grave sites). But, real property with a purely economic function, like a barn used by a farmer for farming, does not fit in either of those categories. It is easily appraised.
And, it is common for people to make improvements to real property that doesn't return $1 in fair market value for every $1 spend on it. But, eminent domain is not based upon book value.
Now, it is important to note that the fair market value of the property that is taken itself is not the only thing that is valued in an eminent domain hearing. An eminent domain hearing also considers the impact that the property taken has on the property that is not taken.
For example, suppose that while the going fair market value of a comparable barn on a comparable amount of real estate is $35,000, but it is the only barn at the farm which is useless without a replacement barn on the premises, and it costs $70,000 to build a replacement in the less than ideal conditions of the remaining land (for example, maybe the farmer has to build a bridge over a river to access the only other part of his land suitable for building a barn at a cost of $35,000 in addition to $35,000 to build the new barn itself).
In that case, the eminent domain award would be more than $70,000, but probably less than $105,000 (most likely $80,000, with $10,000 being for the land and $70,000 for the replacement barn that needs to be built to preserve the value of the rest of the farm).
Impact on the value of property not taken comes up a lot in eminent domain cases involving highway construction. The linked law firm's website illustrates many of the kinds of compensation for harm to the residual caused by a physical taking that are frequently awarded.