Select heat sink under pulsing current
You can model the thermal system in much the same way as an electrical system.  You'll have some amount of thermal resistance between the load and the heatsink, then some amount of thermal resistance between the heatsink and the ambient.  The mass of the heatsink is more or less equivalent to a capacitor.  So you essentially have an RC circuit with a substantial equivalent parallel resistance across the capacitor.  Temperature is analogous to voltage, and the ambient temp makes a convenient ground reference, and thermal power is analogous to current.  You can determine the thermal capacity of the heatsink from its mass and the specific heat of the material it's made of.  

To start with, assume that the heatsink is at ambient temperature.  You know the rate of heat input to your thermal system (the power dissipated by the LM338), so you can multiply that by the thermal resistance between the heatsink and regulator to determine the temperature difference between the two.  As the regulator continues to apply heat to the heatsink, the heatsink will start to increase in temperature at a rate determined by its thermal capacity and the rate of heat input. Once the heatsink is above ambient temperature, heat will start to flow out of it into the environment, so its rate of temperature rise will decrease as its temperature increases.

Eventually the system will reach steady state when the rate at which heat moves from the heatsink to the environment is equal to the rate at which heat moves from the regulator into the heatsink.  You'll recall that this system is, essentially, a resistance divider with a capacitor in parallel, so to determine the steady state heatsink and regulator temperatures, we need only multiply the thermal output of the regulator by the thermal resistance between the heatsink and ambient to get the heatsink temperature, and by the resistance between the regulator and the heatsink to get the difference between the temperature of the regulator and the heatsink.  Add the two temperatures togetehr to get the difference between the regulator and ambient.

(Note that there is also a thermal resistance between the regulator's die and the outside of its package.  So there will be a difference in temperature between the die (which is the bit that you actually need to control the temperature of!) and the package that will be equal to that resistance multiplied by the thermal power dissipated by the regulator.  So in total, your die temperature will be equal to the thermal power multiplied by the sum of the die-to-package, package-to-heatsink, and heatsink-to-ambient temperatures, plus ambient temperature.  However the thermal capacity of the package is probably negligible, so we'll set this aside for now.)

Taking all of this together, you can plot the temperature of both the heatsink and the regulator while your system is in its high-power state, and you can determine the temperature it will reach by the end of the high-power period (it may or may not have reached steady-state by then).  Once your system goes into is low power state, the heatsink will be 'discharged' by its thermal resistance to the environment, and its temperature will fall at a rate determined by that resistance.  As the temperature of the heatsink falls, so too does the rate at which it loses heat, so you wind up with a curve not unlike that of a capacitor in an RC circuit.  Again, you can plot the temperatures during this cooling off period.

Just like in a the equivalent electronic RC circuit, the amount of ripple that appears in the heatsink temperature will depend on the frequency of the input changes relative to the size of the heatsink and the resistive component that discharges it.