<PAGE>
[ILLEGIBLE]                                                        EXHIBIT 10.31

                               FIRM GAS SERVICE
                         EXTENSION AGREEMENT (RATE 120)

THIS AGREEMENT, made and entered into this 7th day of JUNE, 2006, by and between
MONTANA-DAKOTA UTILITIES CO. a Division of MDU Resources Group, Inc., a Delaware
Corporation, 400 North Fourth Street,

Bismarck, North Dakota, hereinafter called "Company" and Red Trail Energy LLC
hereinafter called "Customer" whether one or more.

WHEREAS,Customer has requested that Company provide natural gas service to
Customer at the following location:

County of Stark.                    State of North Dakota and

WHEREAS, such service will necessitate the construction by Company of a gas main
extension and the installation of the necessary facilities.

NOW, THEREFORE, in consideration of the mutual covenants and agreements herein
contained, it is hereby agreed as follows:

1.    Company agrees to construct and install said natural gas Project in
      accordance with the Firm Gas Service Extension Policy Rate 120 and
      Customer agrees that, prior to construction of same, Customer will pay to
      Company the required cost participation for the Project, in the sum of
      $137,384.67 to be paid as follows:

      Irrevocable Letter of Credit

2.    It is further agreed that after facilities have been placed in service,
      Company shall recalculate the Customer's cost participation as outlined
      below.

          Final Actual Cost of Project                            $
                                                                   -----------

          Less Maximum Allowable investment(per Rate 120)         $
                                                                   -----------

          Final Cost Participation                                $
                                                                   -----------

          Preliminary Cost Participation                          $ 137,384.67
                                                                   -----------

          Difference to be:[ ] Paid to Company                    $
                                                                   -----------

                           [ ]  Refunded to Customer              $
                                                                   -----------


3.    Interest will be paid by Company to Customer on any refunds made to
      Customer who has made a cash contribution for the Project. On any refund
      amounts, interest will be calculated annually by the Company at the rate
      required pursuant to the Firm Gas Service Extension Policy Rate 120
      applicable in the state in which the project is located.

4.    "Project", as used in this Agreement, shall include the gas main
      extension(s), valves, service stub(s), or service line(s) complete where
      applicable, any required payments made by the Company to the transmission
      pipeline company to accommodate the extension(s) and other costs excluding
      the distribution meter and regulator.

5.    This Agreement applies only to Company-owned facilities and does not apply
      to Customer-owned facilities. Company shall not be liable for any damages
      on account of injury to or death of persons, or damage to property, due to
      the operation, maintenance, repair or replacement of customer-owned piping
      and equipment. All duties and liabilities in this respect are assumed by
      the Customer.

6.    The following additional terms and conditions shall apply to Company's
      construction of a gas main and installation of the necessary facilities as
      follows:

      This agreement covers the firm load of 7 mcfh (on average 5110 mcf per
      month) and is the first gas through the meter each month. See A of this
      document for further stipulations. Load in excess of 7 mcfh is
      interruptible and is covered under separate agreement. A cash payment of
      $3500 will be made to MDU prior to start of construction to cover
      necessary meter instrumentation. In addition a phone line and 110 volt
      electric line will be provided at the customers expense to the meter point
      for the Interruptible service.

7.    The following documents are attached hereto, and incorporated herein, as
      part of the Agreement:

            a.    Estimate of construction costs

            b.    Map showing the route of the extension

            c.    Economic analysis of the extension

            d.    Firm Gas Service Extension Policy, effective date DEC 12th
                  2002

8.    This Agreement shall be binding upon and inure to the benefit of the
      parties, their respective successors and assigns; but the assignment of
      this Agreement by  either party shall not relieve such party, without the
      written consent of the other, from any of the obligations undertaken by
      this Agreement. Further, this Agreement shall expire on December 1, of the
      year in which it was signed by the Company, or on the following
      date_______, whichever is later if construction of the extension has not
      begun. If the Agreement expires, Company will refund any deposit made by
      Customer end, thereafter, all parties shall be relieved from any and all
      further liability in connection with this Agreement.

      a.    If, within the five-year period after the extension(s) in service
            date, the number of active customers and related volumes exceeds the
            projections used in the economic analysis, the Company shall
            recompute the participation requirement by recalculating the
            maximum allowable investment, in accordance with the Firm Gas
            Service Extension Policy Rate 120. No refund shall be made by
            Company to Customer until the new applicants begin taking service
            from the Company.

      b.    If after the aforementioned five-year period, the Customer's
            participation amount of $137,384.67 has not been fully refunded by
            that time, the obligation of the Company to make refunds shall
            cease. In no event, shall the total amount of refunds exceed the
            amount paid to Company hereunder.

                                   MONTANA DAKOTA UTILITIES CO.
                                   A Division of MDU Resources Group. Inc.

/s/ Mick T. Miller    6-7-06            Ed Williams for RB              6/9/06
----------------------------            --------------------------------------
Customer              Date              Region Manager                  Date
<PAGE>

      Attachment "A" (Red Trail Energy LLC Firm Gas Extension Agreement)

   Annually after the in service date of the constructed natural gas line the
 maximum allowable investment will be recalculated in accordance with Firm Gas
  Service Extension Policy Rate 120. If it is found that firm gas has not been
  used at the annual rate of 61320 mcf for the previous year a cash payment or
draw against the letter of credit will be made to the Company to cover the cost
 of construction. At the discretion of the Company if a partial payment may be
     negotiated annually but in no case will this process extend beyond the
   expiration date of the letter of credit or as prescribed in the Firm Gas
                           Extension Policy Rate 120.
<PAGE>

[LOGO] FIRST NATIONAL BANK                          International Trade Services
                                                    1620 Dodge Street
                                                    Omaha NE 68197
                                                    402.341.0500
                                                    SWIFT: FNBOUS44

JUNE 7, 2006

IRREVOCABLE STANDBY LETTER OF CREDIT
LETTER OF CREDIT NO. STB06200038

BENEFICIARY:
MONTANA - DAKOTA UTILITIES CO.
400 NORTH FOURTH STREET
BISMARCK, ND 58501

GENTLEMEN,

WE HEREBY ESTABLISH OUR IRREVOCABLE LETTER OF CREDIT IN YOUR FAVOR FOR THE
ACCOUNT OF OUR CLIENT:

      RED TRAIL ENERGY, LLC
      3682 HWY 8 S
      RICHARDTON, ND 58652

AVAILABLE AFTER JUNE 7, 2006 BY DRAFTS DRAWN ON FIRST NATIONAL BANK OF OMAHA,
GLOBAL BANKING GROUP, 1620 DODGE STREET STOP 1111, OMAHA, NE 68197
PAYABLE AT SIGHT FOR ANY SUM OR SUMS OF MONEY NOT TO EXCEED IN THE AGGREGATE
USD137,384.67 UNITED STATES DOLLARS ONE HUNDRED THIRTY SEVEN THOUSAND THREE
HUNDRED EIGHTY FOUR AND 67/100).

THIS LETTER OF CREDIT COVERS CAPITAL EXPENDITURES FOR FIRM GAS SERVICE EXTENSION
TO SAID CLIENT UNDER YOUR FIRM GAS SERVICE EXTENSION POLICY RATE 120 NOW ON FILE
WITH THE NORTH DAKOTA PUBLIC SERVICE COMMISSION, AND AS IT MAY BE AMENDED FROM
TIME TO TIME.

ANY DRAFT UNDER THIS LETTER OF CREDIT MUST BE ACCOMPANIED BY YOUR STATEMENT FOR
SUCH CAPITAL EXPENDITURES AND A SIGNED STATEMENT BY ONE OF YOUR OFFICERS THAT
THE AMOUNT DRAWN REPRESENTS THE AMOUNT OF SUCH CAPITAL EXPENDITURE INCURRED BY
YOU IN MAKING SUCH GAS SERVICE EXTENSION THAT REMAINS UNPAID BY SAID CLIENT.
EACH DRAFT DRAWN UNDER THIS LETTER OF CREDIT MUST BE MARKED: "DRAWN UNDER FIRST
NATIONAL BANK OF OMAHA LETTER OF CREDIT NUMBER STB06200038."

WE HEREBY AGREE TO HONOR EACH DRAFT DRAWN UNDER AND IN COMPLIANCE WITH THE TERMS
OF THIS LETTER OF CREDIT WHEN DULY PRESENTED TOGETHER WITH THE DOCUMENTS HEREIN
SPECIFIED, IF DRAWN AND NEGOTIATED ON OR BEFORE DECEMBER 1, 2009.

THIS LETTER OF CREDIT IS SUBJECT TO THE UNIFORM CUSTOMS AND PRACTICE FOR
DOCUMENTARY CREDITS (1993 REVISION), INTERNATIONAL CHAMBER OF COMMERCE,
PUBLICATION NO. 500.

FIRST NATIONAL BANK OF OMAHA

/s/ CHAD GONKA
--------------------------------
AUTHORIZED SIGNATURE

                                  PAGE 1 OF 1

<PAGE>

[LOGO]      MONTANA-DAKOTA UTILITIES CO.
            A Division of MDU Resources Group, Inc.
            400 N 4th Street
            Bismarck, ND 58501

                              STATE OF NORTH DAKOTA
                                GAS RATE SCHEDULE

                                                                  NDPSC Volume 7
                                                           Original Sheet No. 62
FIRM GAS SERVICE EXTENSION POLICY RATE 120

                                                                     Page 1 of 6

The policy of Montana-Dakota Utilities Co. for gas extensions necessary to
provide firm sales service to customers is as follows:

(A) General Rules and Regulations Applicable to all Firm Service Extensions

    1.  An extension will be constructed without a contribution if the estimated
        capital expenditure is cost justified as defined in [Paragraph] A.3.

    2.  The Company may require customer or developer cost participation if the
        estimated capital expenditure is not cost justified.

    3.  The extension will be considered cost justified if the calculated
        maximum allowable investment equals or exceeds the estimated capital
        expenditure using the following formula:

        Maximum Allowable investment =

        Annual Basic Service Charge + (Project Estimated 3rd Year Annual Dk x
        Distribution Delivery Charge)/LARR

        where: LARR = Levelized Annual Revenue Requirement Factor of 19.954%

    4.  Cost of the extension shall include the gas main extension(s), valves,
        service line(s), any required payments made by the Company to the
        transmission pipeline company to accommodate the extension(s), and other
        costs excluding the distribution meter and regulator.

        The service line is that portion of the gas service extending from the
        gas main to the connection at the house regulator and/or meter.

    5.  Where cost participation is required, such extension is subject to
        execution of the Company's standard agreement for extensions by the
        customer or the developer and Company.

<TABLE>
<CAPTION>
<S>          <C>                                             <C>               <C>
DATE FILED:  December 13, 2002                               EFFECTIVE DATE:   Service rendered on and after December 12, 2002

ISSUED BY:   Donald R. Ball                                  CASE NO.:         PU-399-02-183
             Director of Regulatory Affairs
</TABLE>
<PAGE>

[LOGO]  MONTANA-DAKOTA UTILITIES CO.
        A Division of MDU Resources Group, Inc.
        400 N 4th Street
        Bismarck, ND 58501

                              STATE OF NORTH DAKOTA
                                GAS RATE SCHEDULE

                                                                  NDPSC Volume 7
                                                         Original Sheet No. 62.1

FIRM GAS SERVICE EXTENSION POLICY RATE 120

                                                                     Page 2 of 6

      6.    A refund will be made only when there is a reduction in the amount
            of contribution required within a five-year period from the
            extension(s) in service date. Interest will be calculated annually
            by the Company on any refund amounts and shall be equal to the
            average commercial paper interest rate (A1/P1), not to exceed 12
            percent per annum.

            No refund shall be made by Company after the five-year refund period
            and in no case shall the refund excluding interest, exceed the
            amount of the contribution.

      7.    The Company reserves the right to charge customer the cost
            associated with providing service to customer if service is not
            initiated within 12 months of such installation.

(B)   Customer Extensions

      Cost participation for extensions where customers will be immediately
      available for service is as follows:

      1.    Contribution

            (a)   When a contribution is required, the customer(s) shall pay the
                  Company the portion of the capital expenditure not cost
                  justified as determined in accordance with [Paragraph] A.3.

            (b)   The contribution shall be made by:

                  i.    A one-time payment prior to construction, or

                  ii.   Payment of 25% of the contribution prior to construction
                        and the balance in no more than twenty-four equal
                        monthly installments. If customer discontinues service
                        within the twenty-four month period, the balance will be
                        due and payable upon discontinuance of service, or

                  iii.  Customer may post a bond, irrevocable letter of credit,
                        or a written guarantee commitment in the amount of the
                        required contribution prior to construction. Such bond,
                        issued by a bonding company authorized

<TABLE>
<CAPTION>
<S>           <C>                               <C>                <C>
DATE FILED:   December 13, 2002                 EFFECTIVE DATE:    Service rendered on and after December 12, 2002

ISSUED BY:    Donald R. Ball
              Director of Regulatory Affairs    CASE NO.:          PU-399-02-183
</TABLE>

<PAGE>

[LOGO]  MONTANA-DAKOTA UTILITIES CO.
        A Division of MDU Resources Group, Inc.
        400 N 4th Street
        Bismarck, ND 58501

                              STATE OF NORTH DAKOTA
                                GAS RATE SCHEDULE

                                                                  NDPSC Volume 7
                                                         Original Sheet No. 62.2

FIRM GAS SERVICE EXTENSION POLICY RATE 120

                                                                     Page 3 of 6

                  to do business in the state, letter of credit, or written
                  guarantee commitment, shall be effective for the original
                  five-year term and is subject to approval and acceptance by
                  the Company. If at the end of the original five-year term, a
                  contribution requirement exits in the subject project based
                  on a recalculated maximum expenditure, the surety or guarantor
                  shall reimburse the Company for such recalculated contribution
                  requirement, or

            iv.   Customer, upon approval by Company, may finance the amount of
                  the required contribution subject to the following conditions:
                  1) maximum contribution to be financed shall be determined by
                  the Company at its sole discretion, 2) maximum term shall be
                  five years, 3) interest will be charged at the Company's
                  incremental weighted cost of capital.

      (c)   Upon completion of construction, the contribution amount will be
            adjusted to reflect actual costs, and an additional charge may be
            levied or a refund may be made.

      (d)   If within the five-year period from the extension(s) in service
            date, the number of active customers and related volumes exceeds the
            third-year projections, the Company shall recompute the contribution
            requirement by recalculating the maximum allowable investment.

      (e)   The recalculated contribution requirement shall be collected from
            the new applicant(s).

2.    Refund

      (a)   The Company will refund to the original contributor(s) the amount
            required to reduce their contribution to the recalculated
            contribution requirement. No refunds will be made for amounts less
            than $25. Customers who have posted a bond, letter of credit, or
            written guarantee commitment will be notified of any reduction in
            surety or guarantee requirements.

      (b)   No refunds will be made until the new applicants begin taking
            service from the Company.

<TABLE>
<CAPTION>
<S>           <C>                               <C>                <C>
DATE FILED:   December 13, 2002                 EFFECTIVE DATE:    Service rendered on and after December 12, 2002

ISSUED BY:    Donald R. Ball
              Director of Regulatory Affairs    CASE NO.:          PU-399-02-183
</TABLE>
<PAGE>

[LOGO]  MONTANA-DAKOTA UTILITIES CO.
        A Division of MDU Resources Group, Inc.
        400 N 4th Street
        Bismarck. ND 58501

                              STATE OF NORTH DAKOTA
                               GAS RATE SCHEDULE

                                                                  NDPSC Volume 7
                                                         Original Sheet No. 62.3
FIRM GAS SERVICE EXTENSION POLICY Rate 120

                                                                     Page 4 of 6

            (c)   If the addition of new customers will increase the
                  contribution required from existing customer(s), the extension
                  will be considered a new extension and treated separately,

      3.    Incremental Expansion Surcharge

            (a)   The Company, in its sole discretion, may offer an Incremental
                  Expansion Surcharge (Surcharge) to a project consisting of 10
                  or more customers requesting service when the total estimated
                  cost-would otherwise have been prohibitive under the Company's
                  present rates and gas service extension policy. If the Company
                  and customers mutually agree that the project will be funded
                  through a Surcharge, the project will be designated an
                  expansion area and the Surcharge will be applicable to all
                  connections within the expansion area. The contribution
                  requirement to be collected under the Surcharge shall be the
                  amount of the capital expenditure in excess of the Maximum
                  Allowable investment determined -in accordance with
                  [Paragraph] A.3.

                  i.    A minimum up-front payment of $100,00 will be collected
                        from each customer who signs an agreement to
                        participate in the expansion

                  ii.   For projects that are expected to be recovered within a
                        5-year period, the Surcharge shall be set at a fixed
                        monthly charge of $5.00 per month plus $1.50 per dk.

                  iii.  For projects that are not expected to be recovered
                        within a 5-year period, the Surcharge shall be set at a
                        fixed monthly charge of $5.00 per month plus a commodity
                        charge designed to provide recovery of the contribution
                        requirement in a five-year period.

            (b)   The Surcharge shall remain in effect until the net present
                  value of the contribution requirement, calculated using a
                  discount rate equal to the overall rate of return authorized
                  in the last rate case, is collected.

            (c)   The Surcharge shall apply to all customers connecting to
                  natural gas service within the expansion area until the
                  contribution requirement is satisfied.

<TABLE>
<S>         <C>                                    <C>             <C>
DATE FILED: December 13, 2002                      EFFECTIVE DATE: Service rendered on and after
                                                                   December 12, 2002
ISSUED BY:  Donald R. Ball
            Director of Regulatory Affairs         CASE NO.:       PU-399-02-183
</TABLE>

<PAGE>

[LOGO]  MONTANA-DAKOTA UTILITIES CO.
        A Division of MDU Resources Group, Inc.
        400 N 4th Street
        Bismarck, ND 58501

                             STATE OF NORTH DAKOTA
                               GAS RATE SCHEDULE

                                                                  NDPSC Volume 7
                                                         Original Sheet No. 62.4

FIRM GAS SERVICE EXTENSION POLICY RATE 120

                                                                     Page 5 of 6

            (d)   The net present value of the Surcharge will be treated as a
                  contribution-in-aid of construction for accounting purposes.

(C)   Developer Extensions

      Cost participation may be required for extensions such as a subdivision or
      a mobile home court, in which a developer is installing roads, utilizes,
      etc., before housing is built.

      1.    Contribution

            (a)   When a contribution is required, the developer shall pay the
                  Company the portion of the capital expenditure not cost
                  justified as determined in accordance with [Paragraph] A.3.

            (b)   The contribution shall be made by:

                  i.    A one-time payment prior to construction, or

                  ii.   Developer may post a bond, irrevocable letter of credit,
                        or a written guarantee commitment in the amount of the
                        required contribution prior to construction. Such bond,
                        issued by a bonding company authorized to do business in
                        the state, letter of credit, or a written guarantee
                        commitment, shall be effective for the original
                        five-year term and is subject to approval and acceptance
                        by the Company- If at the end of the original five-year
                        term, a contribution requirement exists in the subject
                        project based on a recalculated maximum expenditure, the
                        surety shall reimburse the Company for such recalculated
                        contribution requirement, or

                  iii.  Customer, upon approval by Company, may finance the
                        amount of the required contribution subject to the
                        following conditions: 1) maximum contribution to be
                        financed shall be determined by the Company at its sole
                        discretion, 2) maximum term shall be five years, 3)
                        interest will be charged at the Company's incremental
                        weighted cost of capital.

<TABLE>
<S>         <C>                                    <C>             <C>
DATE FILED: December 13, 2002                      EFFECTIVE DATE: Service rendered on and after
                                                                   December 12, 2002
ISSUED BY:  Donald R. Ball
            Director of Regulatory Affairs         CASE NO.:       PU-399-02-183
</TABLE>

<PAGE>

[LOGO]  MONTANA-DAKOTA UTILITIES CO.
        A Division of MDU Resources Group, inc.
        400 N 4th Street
        Bismarck, ND 58501

                              STATE OF NORTH DAKOTA
                               GAS RATE SCHEDULE

                                                                  NDPSC Volume 7
                                                         Original Sheet No. 62.5
FIRM GAS SERVICE EXTENSION POLICY RATE 120

                                                                     Page 6 of 6

            (c)   Upon completion of construction, the contribution amount will
                  be adjusted to reflect actual costs, and an additional charge
                  may be levied or a refund may be made.

2.    Refund

            (a)   If within the five-year period from the extension(s) in
                  service date, the number of active customers and related
                  volumes exceeds the third-year projections, the Company shall
                  recompute the contribution requirement by recalculating the
                  maximum allowable investment. Such recalculation shall be done
                  annually based upon the anniversary of the extension(s) in
                  service date.

            (b)   The Company will refund to the developer the amount required
                  to reduce their contribution to the recalculated contribution
                  requirement. No refunds will be made for amounts less than
                  $25. Developers who have posted a bond, letter of credit, or
                  written guarantee commitment will be notified of any reduction
                  in surety or guaranty requirements.

            (c)   If the addition of new customer(s) will increase the
                  contribution required from the developer, the extension will
                  be considered a new extension and treated separately.

<TABLE>
<S>         <C>                                    <C>             <C>
DATE FILED: December 13, 2002                      EFFECTIVE DATE: Service rendered on and after
                                                                   December 12, 2002
ISSUED BY:  Donald R. Ball
            Director of Regulatory Affairs         CASE NO.:       FU-399-02-183
</TABLE>